At least id 0 (string), age (int), and other members of the variables;
(2) implement constructor;
3. Love is the destructor:
(4) at least output id, add a member function such as the age;
(5) using the new operator to generate at least one object;
6. Use the delete operator to delete at least one object;
CodePudding user response:
There are big? Help meCodePudding user response:
This is a c + + class,,,,class People
{
Public:
People (string id, int the age);
~ People ();
Private:
String id;
int age;
};
People: People (string id, int age)
{
This - & gt; Id=id;
This - & gt; Age=age;
}
People: : ~ People ()
{
Id. The clear ();
}
People * p1=new People (" 0001 ", 20).
The delete p1;
Slipped to slip