
C++基础
lrstom
没有做不到的,只有想不到的.
展开
-
向基类构造函数传递参数的(两种方法)
第一种方法:#include #include using namespace std;class father{protected:string name;int tall;public:father(string a, int i);father(){cout << "构造基类" << endl;}void print(){cout << name << "身高为: " << tall <<原创 2013-11-27 10:54:46 · 1150 阅读 · 0 评论 -
C++的特性:
函数的隐藏和覆盖在C++中区别是非常之大#include using namespace std;class a{public: void hello() { cout << "基类a的hello函数" << endl; } void hello(int i) { cout << "a.hello(i): " << i << endl; cout << "基类a的原创 2013-11-27 14:09:44 · 537 阅读 · 0 评论