#include <iostream>
#include <string>
using namespace std;
class Person
{
public:
Person();
Person(string strName);
~Person();
void Greeting();
void Goodbye();
void SendMessage(string strMessage);
private:
string strName;
string strMessage;
};
Person::Person(string strName)
{
this->strName = strName;
strMessage = "I have some message for you:\n";
}
Person::Person() : Person("what's your name please")
{
}
Person::~Person()
{
// Do something here
}
void Person::Greeting()
{
cout << "Hello, " << strName << endl
<< strMessage << endl;
}
void Person::Goodbye()
{
cout << "Good luck and see you next time\n" << endl;
}
void Person::SendMessage(string strMessage)
{
this->strMessage += strMessage;
this->strMessage += "\n";
}
int main(void)
{
Person p = Person(/*"Someone"*/);
p.SendMessage("Do you like this tutorial?");
p.SendMessage("Any questions or suggestions?");
p.SendMessage("Send me email or contact me:");
p.SendMessage("fengyhack@gmail.com");
p.SendMessage("QQ:1085894836");
p.Greeting();
p.Goodbye();
system("PAUSE");
return 0;
}