FUNCTION OVERRIDING IN CPP

  #include<conio.h>

#include<iostream>

using namespace std;




class overriding {

    int age;

    public:

    

    void over(){

        cout<<"Enter your age :"<<endl;

        cin>>age;

        cout<<"Age: "<<age;

        

    }

};

class override{

      char name[20];

      public:

      void over(){

          

    cout<<"Enter your name "<<endl;

    cin>>name;

    cout<<"Name :"<<name;

}

      };


int main(){

    overriding obj1;

    obj1.over();

    

    override obj;

    obj.over(); 

    

    return 0;

    

}


Comments

Popular posts from this blog

250+ C Programs for Practice