What are the restrictions apply to constructors and destructors? - C++

What are the restrictions apply to constructors and destructors?

The following restrictions apply to constructors and destructors :
- Constructors and destructors don't return values.
- The addresses of constructors and destructors can't be taken so we can't use references and pointers on them.
- Constructors cannot be declared with the keyword virtual.
- Constructors and destructors cannot be declared static, const, or volatile.
Order in which constructors are called when an object of a derived class is created
Order in which constructors are called - The constructors of any virtual base classes are called first in the order of inheritance..
Difference between a copy constructor and an assignment operator - C++
Difference between a copy constructor and an assignment operator - A copy constructor is used to declare and initialize an object from another object....
What is a virtual destructor? Explain the use of it - C++
What is a virtual destructor? Explain the use of it - If the destructor in the base class is not made virtual, then an object that might have been declared of type base class and instance of child class.....
Post your comment