摘要:
const int x=100;不能修改 仍然是变量 extern const int bufsize;声明 const int & z=x; 不能通过z改变,z不能做坐直 int &a=x; int &b=y; a=b; x=y; 阅读全文
摘要:
1.派生类的各个成员函数不能访问基类的private 2.语法:类名 : public 基类名 3.子类对象的体积=父类对象的体积(成员变量)+子类自己对象的体积(成员变量) 4.public 的变量可以直接访问,不需要通过函数访问,而private 和protected的变量只能够通过函数间接访问 阅读全文
摘要:
#include using namespace std; class Complex { private: double real,imag; public: Complex(double r=0,double i=0):real(r),imag(i){} operator double(){return real;} //返回类型为重载类型 //... 阅读全文