//shows constructor to initialize base class
#include <iostream.h>
class Nine
{
     public:
            int x, y;
            Nine(int a, int b)
            {
                        x=a;
                        y=b;
            }
            void showdata()
            {
                        cout <<"The values are: " <<x <<" and " <<y;
            }
};
class Ten: public Nine
{
            int l,m;
     public:
            Ten(int w, int d) : Nine(w,d)
            {
                        l=w;
                        m=d;
            }
            void showdata()
            {
                        cout <<"The values are: " <<l <<" , " <<m <<" , " <<x <<" , " <<y;
            }
};
int main()
{
            //Nine obj1(3,4);
            Ten obj2(5,6);
            //obj1.showdata();
            obj2.showdata();
            return 0;
}
 
 
-- 
 Pradyut
 http://pradyut.tk
 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
 
 
 
No comments:
Post a Comment