C++中的一个很菜的问题

0 views
Skip to first unread message

shanheyijiu

unread,
Jan 13, 2006, 12:28:53 AM1/13/06
to Programmer Cafe
我是一个C++的初学者,在类的定义中有这么一段代码:
1、private:
2、int x;
3、int y;
4、public:
5、point(int xx=0,int yy=0):x(xx),y(yy) { } ;
6、friend int inrect(const point&,const rect&);
7、......
其中第5行的冒号(:)是什么意思啊?还有第6行的"&"符号是什么意思?
哪位大哥能指教一下。

Stone Jiang

unread,
Jan 13, 2006, 2:27:26 AM1/13/06
to program...@googlegroups.com
: 表示构造函数后面对成员变量进行初始化;
"&" 表示形参为引用


 
在06-1-13,shanheyijiu <shanh...@126.com> 写道:



--
Yours,
Stone Jiang

gTalk: 200...@gmail.com
Reply all
Reply to author
Forward
0 new messages