- #include
-
- using namespace std;
- class Animal
- {
-
- public:
- string name;
- int weight;
- string color;
- string sex;
- public:
- Animal(){}
- Animal(string n,int w,string c,string s):name(n),weight(w),color(c),sex(s)
- {
-
- cout << "我是动物园的讲解员,下面由我来给大家介绍这里的东动物"<< endl;
- }
- //构造纯虚函数
- virtual void perfrom()
- {
-
- }
- void show()
- {
- cout << "name: "<< name<
- cout << "weight:" <
- cout << "color:"<< color<
- cout << "sex:"<< sex<
- }
-
-
-
-
- };
- class Lion:public Animal
- {
- private:
- string say;
- public:
- Lion(){}
- Lion (string n ,int w,string c,string s,string a):Animal(n,w,c,s),say(a)
- {
-
- }
-
- void perfrom()
- {
- cout << "Lion:我要表演狮子怒吼" << endl;
- }
- void show()
- {
- cout << "name: "<< name<
- cout << "weight:" <
- cout << "color:"<< color<
- cout << "sex:"<< sex<
- cout << "技能:say:"<< say <
- }
- };
- class Elephant:public Animal
- {
- private:
- string water;
- public:
- Elephant(){}
- Elephant(string n,int w,string c,string s,string wa):Animal(n,w,c,s),water(wa)
- {
-
- }
- void perfrom()
- {
-
- cout << "elephant:我要表演大象喷水" << endl;
- }
- void show()
- {
- cout << "name: "<< name<
- cout << "weight:" <
- cout << "color:"<< color<
- cout << "sex:"<< sex<
- cout << "技能:water:"<< water <
- }
-
- };
- class Monkey:public Animal
- {
- private:
- string eat;
- public:
- Monkey(){}
- Monkey(string n,int w,string c,string s,string e):Animal(n,w,c,s),eat(e)
- {
-
- }
-
- void perfrom()
- {
- cout << "monkey: 我要表演猴子吃桃" << endl;
- }
- void show()
- {
- cout << "name: "<< name<
- cout << "weight:" <
- cout << "color:"<< color<
- cout << "sex:"<< sex<
-
-
相关阅读:
sql2o 将 sql 语句的结果转换为对象支持命名参数
金仓数据库 KDTS 迁移工具使用指南(3. 系统部署)
简单模拟 Spring 创建的动态代理类(解释一种@Transactional事务失效的场景)
VMware:“Linux恶意软件呈上升趋势”
分类预测 | Matlab实现PSO-LSTM-Attention粒子群算法优化长短期记忆神经网络融合注意力机制多特征分类预测
码蹄集 - MT3521 - X/Y
弘玑Cyclone2022产品发布会:超级自动化下的流程挖掘——弘观流程智能
C#实现一个万物皆可排序的队列
[CISCN2019 华北赛区 Day1 Web2]ikun
【如何学习Python自动化测试】—— 时间等待
-
原文地址:https://blog.csdn.net/m0_69894626/article/details/133798569
-
最新文章
-
沪漂五周年了:我越来越迷茫了
Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
MySQL-Seconds_behind_master的精度误差
[MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
Agent OS :五种驯服不确定性的范式
PortSwigger SQL注入LAB11
数据库即时编译JIT
[Begin]AI Learn Data Day 0
深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU