animal.cpp

来自「一本语言类编程书籍」· C++ 代码 · 共 16 行

CPP
16
字号
// Exercise 15.1 - Animal.cpp
// Implementations of the Animal class and classes derived from Animal

#include "Animal.h"
#include <string>
#include <iostream>
using std::cout;
using std::string;

// Constructor
Animal::Animal(string theName, int wt): name(theName), weight(wt) {}

// Identify the animal
void Animal::who() const {
  cout << "\nMy name is " << name << " and I weigh " << weight << "lbs.";
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?