64,637
社区成员
发帖
与我相关
我的任务
分享
SimpleCat* TheFuction();
int main()
{
SimpleCat* rCat = TheFuction();
int age = rCat->GetAge();
cout << "rCat is: " << age << " years old!" << endl;
cout << "&rCat: " << &rCat << endl;
delete rCat;
return 0;
}
SimpleCat* TheFuction()
{
SimpleCat* Frisky = new SimpleCat(5, 9);
return Frisky;
}
SimpleCat TheFuction();
int main()
{
SimpleCat rCat = TheFuction();
int age = rCat.GetAge();
cout << "rCat is: " << age << " years old!" << endl;
cout << "&rCat: " << &rCat << endl;
return 0;
}
SimpleCat TheFuction()
{
SimpleCat Frisky(5, 9);
return Frisky;
}