建构函式的暗示implicit转型.PPTVIP

  • 3
  • 0
  • 约1.8万字
  • 约 42页
  • 2018-09-27 发布于天津
  • 举报
建构函式的暗示implicit转型.PPT

* 指標與類別:例 (1/2) #include iostream #include string using namespace std; class Kitty { private: char breed[40], name[40]; int cost; public: Kitty(); void PutBreed(char b[]){ strcpy(breed,b); } void PutName(char n[]) { strcpy(name,n); } void PutCost(int c) { cost = c; } void PrintCatInfo(); }; Kitty::Kitty() //constructor { strcpy(breed,unknown); strcpy(name, not named yet); cost = 0; } void Kitty::PrintCatInfo() { cout \n Breed breed \n Name name; cout \n Cost $ cost; } void

文档评论(0)

1亿VIP精品文档

相关文档