摘要: 由于c++不支持对象的动态多态,只有指针或引用支持动态多态。所以,使用一个句柄类(只包含指针数据成员)来支持对象的多态性句柄的使用一般包含如下两种情况:对象的多态性和对象的共同计数源代码如下:#include using namespace std;class point{public: point():x_cdt(0),y_cdt(0){} point(int x,int y):x_cdt(x),y_cdt(y){} int get_x() { return x_cdt;} int get_y() { return y_cdt;} point& set_x(int x)//· 阅读全文
posted @ 2013-08-12 15:14 burcher 阅读(246) 评论(0) 推荐(0) 编辑