Page 187 - DCAP404 _Object Oriented Programming
P. 187

Object-oriented Programming




                    Notes                        cin  >>  std;
                                          }
                                          void  daughter  ::  show  (  )
                                          {
                                                 father  ::  show  (  );
                                                 nfather  ::  show  (  );
                                                 cout  <<  “In  child’s  name  is  :  “<<name;
                                                 cout  <<  “In  child’s  standard:  “<<std;
                                          }
                                          main  (  )
                                          {
                                          clrscr  (  );
                                                 daughter  d1;
                                                 d1.get  (  );
                                                 d1.show  (  );
                                          }
                                   Diagrammatic Representation of Multiple Inheritance is as follows:

                                                   Father                               Mother

                                           Private:                             Private:
                                                  int age;                             int age;
                                                  char name[20];                       char name[20];

                                           Protected:                           Protected:

                                           Public:                              Public:
                                                  void get()                           void get()
                                                  void show()                          void show()







                                                    Class daughter: public Father, public Mother
                                                      Private: char name[20]; int age;

                                                    Protected:

                                                    Public:
                                                    //self
                                                           void get(); void show();
                                                    //from Father
                                                           void get(); void show();
                                                    //from Mother
                                                           void get(); void show();





          180                               LOVELY PROFESSIONAL UNIVERSITY
   182   183   184   185   186   187   188   189   190   191   192