Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class student{
- int x;
- public:
- student(){
- x = 67;
- cout<<"constructor called x is ";
- }
- void display(){
- cout<<x<<endl;
- }
- ~student(){
- cout<<"Destructor called";
- }
- };
- int main()
- {
- student s;
- s.display();
- return 0;
- }
- /*
- Output
- constructor called x is 67
- Destructor called
- */
Advertisement
Add Comment
Please, Sign In to add comment