int main() { Cat * Family[500]; int i; Cat * pCat; for (i = 0; i < 500; i++) { pCat = new Cat; pCat->SetAge(2*i +1); Family[i] = pCat; } /* for (i = 0; i < 500; i++) { cout << "Cat #" << i+1 << ": "; cout << Family[i]->GetAge() << endl; } */ cout<<sizeof(Family[0])<<"\t\tbytes"<<endl; cout<<sizeof(*Family[0])<<"\t\tbytes"<<endl; cout<<sizeof(Family)<<endl; cout<<sizeof(*pCat)<<endl; cout<<sizeof(pCat)<<endl; cout<<sizeof(Cat*)<<endl; cout<<sizeof(Cat)<<endl; cout<<sizeof(int)<<endl; return 0; }
void f11_2(){ Cat frisky; frisky.SetAge(5); frisky.Meow(); cout <<"cat age=" <<frisky.GetAge() <<endl; frisky.Meow(); }
int main() { Cat Frisky; Frisky.SetAge(5); Frisky.Meow(); std::cout << "Frisky is a cat who is "; std::cout << Frisky.GetAge() << "years old.\n"; Frisky.Meow(); return 0; }