Sunday, 3 February 2019

Write a Program of Constructor and Destructor in c++

Program to implement the concept of  and destructor in C++



#include<iostream.h>
#include<conio.h>
 class A
 {  int x;
public :A()    //creating a constructor
{


cout<<"\n EXecution in constructor";

 }
 public: ~A()   //creating a destructor
{
cout<<"\n Execution in Destructor";
 }};
int main()
{clrscr();
A* obj=new A; //making an object will call constructor automatically
delete obj; //deleting object will call destructor automatically

getch();
return 0;}




OutPut screen will look like this:-


No comments:

Post a Comment

EMPLOYABILITY SKILLS – PRACTICAL FILE

 ðŸŒŸ EMPLOYABILITY SKILLS – PRACTICAL FILE --- S. No. Title of Practical / Activity 1. Preparation of a Professional Resume in Proper For...