fork(3) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class mother{
  6. public:
  7. virtual void display(){
  8. cout<<"Mother"<<endl;
  9. }
  10. };
  11. class daughter : public mother{
  12. public:
  13. void display(){
  14. cout<<"Daughter"<<endl;
  15. }
  16. };
  17. int main(){
  18. daughter rita;
  19. mother mother;
  20. rita.display();
  21. rita.mother::display(); //error
  22. return 0;
  23. }
Success #stdin #stdout 0s 5520KB
stdin
Standard input is empty
stdout
Daughter
Mother