#include <string>
#include <cstdint>
#include <iostream>
class Animal
{
private:
std::uint8_t m_uchLegs;
std::string m_strSpecies;
public:
Animal(std::uint8_t uchLegs = 0, const std::string& strSpecies = "")
: m_uchLegs(uchLegs), m_strSpecies(strSpecies) {};
std::uint8_t getLegs() const;
std::string getSpecies() const { return m_strSpecies; }
void presentYourself() const;
};
class Cat : public Animal
{
public:
Cat() : Animal(4, "Cat") { }
};
int main()
{
Cat c;
Animal& a = c;
std::cout << "a's species: " << a.getSpecies() << '\n';
}
I2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGNzdGRpbnQ+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCmNsYXNzIEFuaW1hbAp7CnByaXZhdGU6CiAgICBzdGQ6OnVpbnQ4X3QgbV91Y2hMZWdzOwogICAgc3RkOjpzdHJpbmcgbV9zdHJTcGVjaWVzOwoKcHVibGljOgogICAgQW5pbWFsKHN0ZDo6dWludDhfdCB1Y2hMZWdzID0gMCwgY29uc3Qgc3RkOjpzdHJpbmcmIHN0clNwZWNpZXMgPSAiIikKICAgICAgICA6IG1fdWNoTGVncyh1Y2hMZWdzKSwgbV9zdHJTcGVjaWVzKHN0clNwZWNpZXMpIHt9OwoKICAgIHN0ZDo6dWludDhfdCBnZXRMZWdzKCkgY29uc3Q7CiAgICBzdGQ6OnN0cmluZyBnZXRTcGVjaWVzKCkgY29uc3QgeyByZXR1cm4gbV9zdHJTcGVjaWVzOyB9CiAgICB2b2lkIHByZXNlbnRZb3Vyc2VsZigpIGNvbnN0Owp9OwoKY2xhc3MgQ2F0IDogcHVibGljIEFuaW1hbAp7CnB1YmxpYzoKICAgIENhdCgpIDogQW5pbWFsKDQsICJDYXQiKSB7IH0KfTsKCmludCBtYWluKCkKewogICAgQ2F0IGM7CiAgICBBbmltYWwmIGEgPSBjOwogICAgc3RkOjpjb3V0IDw8ICJhJ3Mgc3BlY2llczogIiA8PCBhLmdldFNwZWNpZXMoKSA8PCAnXG4nOwp9Cg==