為中華之崛起而崛起! 兼聽則明,偏聽則暗。
posted on 2009-03-26 16:33 luqingfei 閱讀(1945) 評論(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(); } 回復 更多評論