Which of the following, in C++, is inherited in a derived class from base class ?
(A) constructor
(B) destructor
(C) data members
(D) virtual methods
Answer: (C)
Explanation:
- Data members in C++ is inherited in a derived class from base class
- Constructor is a member function of a class which initializes objects of a class. In C++,Constructor is automatically called when object(instance of class) create.It is special member function of the class.
- Destructor is a member function which destructs or deletes an object.
- Virtual methods is a method which is redefined(Over-riden) in derived class.
So, option (C) is correct.
Quiz of this Question