#include<iostream>
#include<conio.h>
using namespace std;
class person
{
public :
char
name[30], fname[30], contact[13], address[40];
person() //Constructor
{
cout<<"Enter
Person Name: ";
gets(name);
cout<<"Enter
person's FName: ";
gets(fname);
cout<<"Enter
Contact No: ";
gets(contact);
cout<<"Enter
Address: ";
gets(address);
}
void show();
void sleep()
{
cout<<"Person
is Sleeping"<<endl;
}
void wake_up()
{
cout<<"Person
is Wakeup"<<endl;
}
void walk()
{
cout<<"Person is Walking"<<endl;
}
void run()
{
cout<<"Person
is Running"<<endl;
}
~person() //destructor
{
cout<<"\nAt
the End Person Die";
}
};
void person::show()//Resolution operator
Method
{
cout<<"\nPerson
Name = "<<name<<endl;
cout<<"Father
Name ="<<fname<<endl;
cout<<"Contact=
"<<contact<<endl;
cout<<"Address=
"<<address<<endl<<endl;
}
int main()
{
person s;
s.show();
s.sleep();
s.wake_up();
s.walk();
s.run();
getch();
}Output |
No comments:
Post a Comment