Explain calling an object's member function(declared
virtual)from its constructor?
Answer / deepak
It will depend on when pointer to vtable is initialised.
generally if constructor is already defined compiler insert
code to initialise virtual table pointer as first statement
inside defined constructor. If vptr is initialised before
calling virtual function then it will be invoked, if vptr is
not initialised then it can crash.
| Is This Answer Correct ? | 2 Yes | 1 No |
How to defines the function in c++?
What do you mean by vtable and vptr in c++?
What are shallow and deep copy?
What is a set in c++?
Difference between Operator overloading and Functional overloading?
class A { public: void f(); protected: A() {} A(const A&){} }; Examine the class declaration shown above. Why are the default and copy constructors declared as protected? 1. To ensure that A cannot be created via new by a more derived class 2. To ensure that A cannot be copied 3. To ensure that A cannot be used as a base class except when public inheritance has been used 4. To ensure that A cannot be created/copied outside the inheritance chain 5. To ensure that A cannot be instantiated as a static variable
Are iterators pointers?
What is virtual base class?
When should you use global variables?
What is switch case in c++ syntax?
an integer constant must have atleast one a) character b) digit c) decimal point
How is an Abstract Base Class(ABC) related to an "Abstract Data Type" (ADT)