摘要:
全局函数做友元 #if 0 #include <iostream> #include <string> using namespace std; //用friend关键字访问类中private的函数方法。 class Building { //2.在此用friend关键字声明! friend voi 阅读全文
摘要:
类对象作为类成员 #include <iostream> #include <string> using namespace std; //c++类中的成员可以是另一个类的对象,称为对象成员。 class A { public: A() { cout << "A side \n"; }; ~A() 阅读全文
摘要:
类定义 #include <iostream> #include <string> using namespace std; #define PI 3.141592657 class Circle { //访问权限 //公共权限 public: //属性 int half_r; //行为 doubl 阅读全文