Page 184 - DCAP404 _Object Oriented Programming
P. 184

Unit 9: Inheritance




                 {                                                                              Notes
                         manager  :  :  get  (  );
                         cout  <<  “no.  of  managers  under  you  are:”;  cin  >>  nom;
                 }
                         manager  :  :  show  (  );
                         cout  <<  “In  the  no.  of  managers  under  me  are:  In”;

                         cout  <<  “nom;
                 }
                 main  (  )
                 {
                 clrscr  (  );
                         ceo  c1;
                         c1.get  (  );  cout  <<  “\n\n”;
                         c1.show  (  );
                 }

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

                                        Protected:

                                        Private:
                                             int age;
                                             char name[20];



                                           Manager: Worker

                                        Private:
                                             int now;

                                        Protected:

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


                                            Ceo : Manager

                                        Public:

                                        Protected:

                                        Public:
                                             All the inherited
                                             members




                                           LOVELY PROFESSIONAL UNIVERSITY                                   177
   179   180   181   182   183   184   185   186   187   188   189