![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C & C++
wwwjfy
...
展开
-
C++中的引用
引用返回就返回一个“实体”,一般用到的地方就是引用传一个对象,再引用返回,比如cout对operatorostream& operator这样之后,cout再举个例子:int& incc(int& a,int b){ a=a+b; return a;}main(){ int i=1; incc(i,1);//i=2 ++(incc(i,1));//i=4 incc(incc原创 2006-12-23 10:12:00 · 667 阅读 · 0 评论 -
继承下的构造函数
首先调用的是对象基本部分的构造函数,然后调用派生类的适当构造函数。 class Base{ protected: int a; public: Base() //默认构造函数 { a = 0; } Base(int c) //单参数构造函数 { a = c; }};class Derived:public Base{ pu转载 2006-12-23 10:26:00 · 610 阅读 · 0 评论