You are on page 1of 1

/* IMPLEMENTATION OF DIFFERENT TYPES OF CONSTRUCTORS */ #include<iostream.h> #include<conio.

h> class data { private: int x,y,z; public: data(void) { x = 0; y = 0; z = 0; cout<<"This Is The First Type Of The Constructor"<< endl; cout<< " The Three Values Are"<< x<< ","<< y<< ","<< z<< endl<< endl; } data(int a) { x = a; y = 0; z = 0; cout<< "This Is The Second Type Of The Constructor"<< endl; cout<< "The Three Values Are"<< x<< ","<< y<< ","<< z<< endl<< endl; } data(int a,int b) { x = a; y = b; z = 0; cout<< "This Is The Third Type Of The Constructor"<< endl; cout<< "The Three Values Are"<< x<< ","<< y<< ","<< z<< endl << endl; } data(int a,int b,int c) { x = a; y = b; z = c; cout<< "This Is The Fourth Type Of The Constructor"<< endl; cout<<"The Three Values Are"<< x<<" ,"<< y<< ","<< z<< endl; } }; void { data data data data main() d1(); d2 = data(9); d3(1,2); d4(1,2,4);

getch(); }

You might also like