为中华之崛起而崛起! 兼听则明,偏听则暗。
posted on 2009-03-26 16:33 luqingfei 阅读(1913) 评论(1) 编辑 收藏 引用 所属分类: C++基础
#include <iostream.h> #include <string.h> class Animal { private: char name[6], int weight; public: void who(char n[6], int w) { strcpy(n,name); w=weight; cout<<"These is animal`s name and weigth is :"<<n<<';'<<w<< } }; class Lion:pubilc Animal { public: char ln[6],int lw; }; void main() { Lion l1("leo",400); l1.who(); } 回复 更多评论