Tuesday, 20 April 2021

Constructor in C++ - 3

 #include<iostream.h>

#include<conio.h>

class A

{

public:

A()

{

cout<<"Default"<<endl;

}

A(int a)

{

cout<<"P-C"<<endl;

}

~A()

{

out<<"D-A"<<endl;

}


};

main()

{

clrscr();


A ob;

{

A ob1;

A ob2(6);

}


getch();

return 0;

}

No comments:

Post a Comment