Subscribe Us

Responsive Advertisement

Advertisement

inheritance oop in cpp(1)

 


inheritance oop in cpp(1)



#include<bits/stdc++.h>

using namespace std;

class animal

{

public :

    int leg=4;

};

class dog : public animal

{

public :

    int ear=2;

};

int main()

{

    dog d;

    cout<<d.leg<<endl;

    cout<<d.ear<<endl;


    return 0;

}


Post a Comment

0 Comments