Boolan_C++面向对象高级编程(上)-第2周

内存块

Complex

class complex {
public:
    complex (double r = 0, double i = 0): re (r), im (i) { }
    complex& operator += (const complex&);
    complex& operator -= (const complex&);
    complex& operator *= (const complex&);
    complex& operator /= (const complex&);
    double real () const { return re; }
    double imag () const { return im; }
private:
    double re, im;
    friend complex& __doapl (complex *, const complex&);
    friend complex& __doami (complex *, const complex&);
    friend complex& __doaml (complex *, const complex&);
};

动态分配所得内存 in VC

Boolan_C++面向对象高级编程(上)-第2周_第1张图片
1.png

动态分配所得的array

Boolan_C++面向对象高级编程(上)-第2周_第2张图片
2.png

array new 为什么要搭配array delete

Boolan_C++面向对象高级编程(上)-第2周_第3张图片
3.png

你可能感兴趣的:(Boolan_C++面向对象高级编程(上)-第2周)