Monday, October 10, 2011

C++ example program to understand constructor and inheritance of objects.



  This post contains the c++ example code to understand constructors and inheritance...








#include<iostream.h>
#include<conio.h>
class B
{
};
class D:public B
{
 public:
  void msg()
  {
   cout<<"No constructors in base class and derived class"<<endl;
  }

};
void main()
{
 D objd;
 clrscr();
 objd.msg();
 getch();
}

Hope this helps.

                                                                                                                                     Techytips

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons