摘要: #include <iostream> #include <string> namespace { class A { public: void addCount() { ++sumCount; } static int getSumCount() { return sumCount; } priv 阅读全文
posted @ 2024-07-19 19:49 double64 阅读(1) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> namespace { class A { public: const A& get_self() const { std::cout << "常量版本" << std::endl; return *this; } A& g 阅读全文
posted @ 2024-07-19 14:46 double64 阅读(1) 评论(0) 推荐(0) 编辑
摘要: C++ class 和 struct 可以相互继承吗? #include <iostream> #include <string> namespace { class A { public: std::string name = "小明"; }; struct B :public A { int a 阅读全文
posted @ 2024-07-19 11:30 double64 阅读(6) 评论(0) 推荐(0) 编辑