十一月三十日作业

#include 

using namespace std;


class Per
{
private:
    string name;
    int age;
    double *weight;
    double  *height;
public:
    Per(){}
    Per(string name,int age,double weight , double height):name(name),age(age),weight (new double (weight)),height(new double(height))
    {
        cout << "Per::这是构造函数" << endl;
    }
    void show()
    {

        cout << name << " "    ;
        cout << age << " "  ;
        cout << *weight << " " ;
        cout << *height << " " ;
    }
    ~Per()
    {
        cout << "1析构函数" << endl;
        delete weight;
        delete height;
    }
    Per(const Per &other):name(other.name),age(other.age),weight(new double(*(other.weight))),height(new double(*(other.height)))
    {
        cout << "这是拷贝构造函数" << endl;
    }
};

class Stu
{
private:
    int score;
    Per p1;
public:
    Stu(){}
    Stu(int score,string name,int age, double weight,double height):score(score),p1(name,age,weight,height)
    {
        cout << "这个是Stu的构造函数" << endl;
    }
    ~Stu()
    {
        cout << "qwe" <

你可能感兴趣的:(javascript,开发语言,ecmascript)