0
Explain step by step, please helpš
#include <iostream> using namespace std; class Mother { public: Mother() {}; void sayHi() { cout << "Hi"; } }; class Daughter: public Mother { public: Daughter() {}; }; int main() { Daughter d; d.sayHi(); }
2 Answers
+ 2
class Mother is the base class witch contains a method sayHi.
class Daughter is a class that inherrits from class Mother so it has access to the method sayHi.
d is an instance of the class Daughter so we can call the method sayHi