Following relationship holds in any n-ary tree in which every node has either 0 or n children. L = (n-1)*I + 1
In C and C++, comma is the last operator in precedence table. So comma should be carefully used on right side of an assignment expression.
In C++, pre-increment (or pre-decrement) can be used as l-value, but post-increment (or post-decrement) can not be used as l-value.
In C++, following are the general rules for operator overloading.
In C++, assignment operator should be overloaded with self assignment check.
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.
Predict the output of below C++ programs.
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.
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.
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).
Write a function to generate all possible n pairs of balanced parentheses.