C++ - Programming Language
This course covers the basics of programming in C++. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!

Inheritance

Lesson 31
Author : 🦒
Last Updated : November, 2017


Code

Copyclass Chef{
     public:
          void makeChicken(){
               cout << "The chef makes chicken" << endl;
          }

          void makeSalad(){
               cout << "The chef makes salad" << endl;
          }

          void makeSpecialDish(){
               cout << "The chef makes a special dish" << endl;
          }
};

class ItalianChef : public Chef{
     public:
          void makePasta(){
               cout << "The chef makes pasta" << endl;
          }

          // override
          void makeSpecialDish(){
               cout << "The chef makes chicken parm" << endl;
          }
};

int main(){

     Chef myChef();
     myChef.makeChicken();

     ItalianChef myItalianChef();
     myItalianChef.makeChicken();

     return 0;
}