C++基础知识 – 继承和派生的实现

继承和派生的实现
分析:
父类 Father.h
#pragma once
#include
using namespace std;

class Father{
public:
Father(string name, int age);
~Father();
string getName() const;
int getAge() const;
string description() const;
private:
string name;//姓名
int age; //年龄
};

父类 Father.cpp
#include
#include "Father.h"

Father::Father(string name, int age){
this->name = name;
this->age = age;
}

Father::~

C++基础知识 – 继承和派生的实现最先出现在Python成神之路

版权声明:
作者:ht
链接:https://www.techfm.club/p/22642.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>