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 |
What language does google use?
What is difference between n and endl in c++?
what is a reference variable in C++?
Write about the retrieval of n number of objects during the process of delete[]p?
template<class T, class X> class Obj { T my_t; X my_x; public: Obj(T t, X x) : my_t(t), my_x(x) { } }; Referring to the sample code above, which one of the following is a valid conversion operator for the type T? a) T operator T () { return my_t; } b) T operator(T) const { return my_t; } c) operator(T) { return my_t; } d) T operator T (const Obj &obj) { return obj.my_t; } e) operator T () const { return my_t; }
Can inline functions have a recursion? Give the reason?
What is private public protected in c++?
What do you mean by ‘void’ return type?
Is C++ case sensitive a) False b) Depends on implementation c) True
Is main a class in c++?
What is runtime polymorphism in c++?
Is string data type in c++?