class Student
{
public:
string setName(string _name)
{m_strName = _name;
return m_strName;}
string getName()
{return m_strName;}
private:
string m_strName;
};
int main()
{Student *str = new Student();
str->setName("慕课网");
cout << str->getName();
delete str;
str = NULL;
system("pause");
return 0;}
{
public:
string setName(string _name)
{m_strName = _name;
return m_strName;}
string getName()
{return m_strName;}
private:
string m_strName;
};
int main()
{Student *str = new Student();
str->setName("慕课网");
cout << str->getName();
delete str;
str = NULL;
system("pause");
return 0;}