徽班进京
sangix
全部博文(28)
2012年(3)
2011年(2)
2008年(2)
2007年(7)
2006年(14)
machiqia
shiyiLiu
kreensn
caisanpx
xrmmhh
hugowfye
hanye韩
luokaich
飞鸿无痕
分类: C/C++
2006-10-20 13:54:05
class Flower { public: Flower(int color); virtual ~Flower(); public: void Blow(void); void SetColor(int color); float GetColor(void); << ... >> private: int m_nColor; << ... >> }
/* file: flower.c */ #include <stdio.h> static int _hb_color = 0.0f; voidflower_set_color(int color) { _hb_color = color; } int flower_get_color(void) { return _hb_color; } void flower_blow(void) { printf("listen, the flower's blowing voice ... \n"); }
class Rose : public Flower {
public:
Rose(int nThorn);
virtual ~Rose(); << ... >> public:
void SetThornNumber(int nThorn); int GetThornNumber(); private: int m_nThorn; }
/* flower.c */ <<< ... >>> static int _hb_thorn = 1; void rose_set_color(int color) { flower_set_color(color); } int rose_get_color(void) { return flower_get_color(); } void rose_blow(void) { printf("listen, rose is blowing, and your lover is coming ... \n"); } void rose_set_thorn_nr(int thorn) { _hb_thorn = thorn; } int
/* flower.c */ <<< ... >>> static int _hb_thorn = 1; void rose_set_color(int color) { flower_set_color(color); }
int rose_get_color(void) { return
flower_get_color()
; }
void rose_blow(void) { printf("listen, rose is blowing, and your lover is coming ... \n"); } void rose_set_thorn_nr(int thorn) { _hb_thorn = thorn; } int
rose_get_thorn_nr(void) { return _hb_thorn; }
上一篇:Inside Object-Oriented Programming Using ANSI C
下一篇:正在写 undo/redo 的实现
登录 注册