int main(void)
{
Student *stu = new Student();
stu->setName("m");
cout << stu->getName() << endl;
delete stu;
stu = NULL;
return 0;
{
Student *stu = new Student();
stu->setName("m");
cout << stu->getName() << endl;
delete stu;
stu = NULL;
return 0;
class Student
{
public:
Student(){};
Student(string _name)
{
m_strName = _name;
};
Student(const Student& stu){};
~Student(){};
void setName(string _name)
{
m_strName = _name;
}
string getName()
{
return m_strName;
}
private:
string m_strName;
};
{
public:
Student(){};
Student(string _name)
{
m_strName = _name;
};
Student(const Student& stu){};
~Student(){};
void setName(string _name)
{
m_strName = _name;
}
string getName()
{
return m_strName;
}
private:
string m_strName;
};
class Student
{
public:
void setName(string _name)
{
m_strName = _name;
}
string getName()
{
return m_strName;
}
private:
string m_strName;
};
int main()
{
Student *str = new Student;
str->setName("慕");
cout << str->getName() << endl;
delete str;
str = NULL;
return 0;
}
{
public:
void setName(string _name)
{
m_strName = _name;
}
string getName()
{
return m_strName;
}
private:
string m_strName;
};
int main()
{
Student *str = new Student;
str->setName("慕");
cout << str->getName() << endl;
delete str;
str = NULL;
return 0;
}