Sunday, 27 November 2011

C++ Program For Constructor


#include<iostream.h>
#include<conio.h>
class test
 {
  int i,j;
  public:
  test()
   {
    
    }test(int x,int y)
 {
   i=x;
j=y;
 }
void display()
 {
   cout<<endl<<j;
 }
};
void main()
{
  test t1,t2(5,6);
  clrscr();
  t2.display();
  getch();
}

No comments:

Post a Comment