Saturday, May 05, 2007

c++ program to show the sequence of output from derived class

 

 

//Show the sequence of output from derived class

 

#include <iostream>

#include <conio.h>

 

using namespace std;

 

class Abc

{

public:

            Abc()

            {

                        cout<<"This is inside ABC" <<endl;

            }

            void show()

            {

                        cout <<"This is the show method" <<endl;

            }

};

 

class New : public Abc

{

public:

            New()

            {

                        cout <<"This is inside New" <<endl;

            }

};

 

int _tmain(int argc, _TCHAR* argv[])

{

            cout <<"testing" <<endl;

            New obj;

            obj.show();

            getch();

            return 0;

}

 

/*

OUTPUT:

            testing

            This is inside ABC

            This is inside New

            This is the show method

*/

 

 

 

 

--
Pradyut
http://nvoids.com
http://oop-edge.blogspot.com/
http://pradyutb.blogspot.com/
http://praddy-photos.blogspot.com/
http://oop-edge.spaces.live.com/
http://www.flickr.com/photos/praddy
http://groups.google.com/group/oop_programming
India

 

No comments: