Which special member function is executed automatically when an object of a class is created?
- A.Destructor
- B.Constructor
- C.Friend function
- D.Virtual function
Show answer
A constructor carries the same name as its class, is called automatically the moment an object is created and is normally used to give the data members their initial values; it returns no value at all, not even void, and it can be overloaded.
Read the full explanation →