Wednesday 7 August 2013

Multiple Inheritance(6)

#include<iostream.h>
#include<conio.h>
class mahi
{
    public:
        char *name;
        void put1()
        {
            name="MaHi";
        }
        void show1(void);
};
void mahi::show1()
{
    cout<<"\n 1. "<<name;
}
class bipin:public mahi
{
    public:
        void put2()
        {
            name="Bipin";
        }
        void show2(void);
};
void bipin::show2()
{
    cout<<"\n 2. "<<name;
}
class ashish:public bipin
{
    public:
        void put3()
        {
            name="Ashish";
        }
        void show3(void);
};
void ashish::show3()
{
    cout<<"\n 3. "<<name;
}
class dhananjay:public ashish
{
    public:
        void put4()
        {
            name="Dhananjay";
        }
        void show4(void);
};
void dhananjay::show4()
{
    cout<<"\n 4. "<<name;
}
class satish:public dhananjay
{
    public:
        void put5()
        {
            name="Satish";
        }
        void show5(void);
};
void satish::show5()
{
    cout<<"\n 5. "<<name;
}
void main()
{
    clrscr();
    cout<<"\n Topers"<<endl<<endl;
    satish m1;
    m1.put1();
    m1.show1();
    m1.put2();
    m1.show2();
    m1.put3();
    m1.show3();
    m1.put4();
    m1.show4();
    m1.put5();
    m1.show5();
    getch();
}

Here is The Output:))

 

No comments:

Post a Comment