2016年8月25日

重载操作符- 友元函数- 非/模板类重载

摘要: #include #include #include using namespace std; template class A; template ostream &operator&obj); template class A{ public: A(int i):data(i){} friend ostream& operator(ostream &out,... 阅读全文

posted @ 2016-08-25 18:10 暴力的轮胎 阅读(205) 评论(0) 推荐(0) 编辑

静态成员变量

摘要: 1.静态成员函数中不能调用非静态成员。2.非静态成员函数中可以调用静态成员。因为静态成员属于类本身,在类的对象产生之前就已经存在了,所以在非静态成员函数中是可以调用静态成员的。 3.静态成员函数只能访问静态类的原因:静态方法属于整个类,在对象创建之前就已经分配空间,类的非静态成员要在对象创建后才有内 阅读全文

posted @ 2016-08-25 09:55 暴力的轮胎 阅读(153) 评论(0) 推荐(0) 编辑

导航