摘要:
前缀++ 后缀++ 运算符重载 前缀++ 后缀++ 运算符重载 2012-12-06 10:38 1733人阅读 评论(0) 收藏 举报 2012-12-06 10:38 1733人阅读 评论(0) 收藏 举报 分类: C常用备查(24) C++(43) 分类: C常用备查(24) C++(43) 阅读全文
摘要:
//继承的方式:public private protected/*1.私有成员不能被继承2.公有继承保持不变3.私有继承变为私有4.保护继承变为保护 创建一个子类对象时,先调用父类的构造函数再调子类的构造函数销毁一个对象时,先调用子类的析构函数再调父类的析构 子类对象和父类对象的转换:子类可转换成 阅读全文
摘要:
class cMyString{ char* m_str; int m_strSize;public: cMyString();//指针指向一个空字符串 cMyString(char* str);//字符串初始化 ~cMyString(); char* getStr()const; int getS 阅读全文
摘要:
class date{ int year, mouth, day;public: date(int year, int mouth, int day) :year(year), mouth(mouth), day(day){} int getYear()const { return year; } 阅读全文
摘要:
class component{public: virtual void print()const = 0;}; class composite :public component{ component* m_child;public: void setChild(component* child) 阅读全文
摘要:
class vehicle{ int MaxSpeed; int Weight;public: vehicle(int maxspeed, int weight) :MaxSpeed(maxspeed), Weight(weight){} ~vehicle(){} int getMaxspeed() 阅读全文
摘要:
class VectorBase{ int len;public: VectorBase(int len) :len(len){} int length()const { return len; } virtual double getElement(int i) const = 0; virtua 阅读全文
摘要:
class Line{ double x1, y1; double x2, y2;public: Line(double x1, double y1, double x2, double y2) { this->x1 = x1; this->x2 = x2; this->y1 = y1; this- 阅读全文
摘要:
class Point{public: const double x, y; Point(double x =0.0, double y=0.0 ) :x(x),y(y){} double distanceTo(const Point& p) const { return sqrt((x - p.x 阅读全文
摘要:
class Dog{ DOGCOLOR color; char name[20]; static int count;public: Dog(char name[], DOGCOLOR color) { strcpy(this->name, name); this->color = color; } 阅读全文