?? list0904.cpp
字號(hào):
// Listing 9.4 - References to class objects
#include <iostream>
class SimpleCat
{
public:
SimpleCat (int age, int weight);
~SimpleCat() {}
int GetAge() { return itsAge; }
int GetWeight() { return itsWeight; }
private:
int itsAge;
int itsWeight;
};
SimpleCat::SimpleCat(int age, int weight)
{
itsAge = age;
itsWeight = weight;
}
int main()
{
SimpleCat Frisky(5,8);
SimpleCat & rCat = Frisky;
std::cout << "Frisky is: ";
std::cout << Frisky.GetAge() << " years old." << std::endl;
std::cout << "And Frisky weighs: ";
std::cout << rCat.GetWeight() << " pounds." << std::endl;
return 0;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -