How to write a constructor program in C++ ?
Constructer जो की ऑब्जेक्ट (object ) को initialization करने का काम करता है | इसमें क्लास नाम का Same फंक्शन बनता है जो की इसको indentify करता है |
Program in C++
#include <iostream>
#include<conio.h>
using namespace std;
class employee
{
public:
employee()
{
cout<<"thanks for using first constructor program in c++ "<<endl;
}
};
main()
{
employee x,y,z;
getch();
}
OUTPUT:
thanks for using first constructor program in c++
thanks for using first constructor program in c++
thanks for using first constructor program in c++
No comments:
Post a Comment