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(); }

15th Feb 2020, 9:03 PM
Hussein Ashammeri
Hussein Ashammeri - avatar
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
15th Feb 2020, 9:09 PM
Gabriel Ilie
Gabriel Ilie - avatar