G-Fact 11

Following relationship holds in any n-ary tree in which every node has either 0 or n children. L = (n-1)*I + 1

Virtual Destructor

Deleting a derived class object using a pointer to a base class that has a non-virtual destructor results in undefined behavior. To correct this situation, the base class should be defined with a virtual destructor.

Virtual functions in derived classes

In C++, once a member function is declared as a virtual function in a base class, it becomes virtual in every class derived from that base class. In other words, it is not necessary to use the keyword virtual in the derived class while declaring redefined versions of the virtual base class function.

What is conversion constructor in C++?

In C++, if a class has a constructor which can be called with a single argument, then this constructor becomes conversion constructor because such a constructor allows automatic conversion to the class being constructed.

Inheritance and friendship

In C++, friendship is not inherited. If a base class has a friend function, then the function doesn’t become a friend of the derived class(es).