• 2024-12-09实验5 继承和多态
    实验任务三源码如下:1#pragmaonce2#include<iostream>3#include<string>4usingstd::string;5usingstd::cout;6usingstd::endl;7classMachinePets{8private:9stringnickname;10public:11MachinePets(conststring
  • 2024-12-02实验5 继承和多态
    任务3源码:1#pragmaonce23#include<iostream>4#include<string>56usingstd::string;789classMachinePets{10public:11MachinePets(conststring&s);1213public:14virtualstringget_nickname
  • 2024-12-02OPP实验五
    任务一、 任务二、 2【通过sort库函数来实现,其中,写了一个比较函数来作为sort的参数】 3【通过ChatGPT】 3、任务三、 1#pragmaonce2#include<string>3usingnamespacestd;45classMachinePets{6private:7stringnickname;8pub
  • 2022-11-30实验五
    task.4cpp#include<iostream>#include"Pets.hpp"voidplay(MachinePets&obj){std::cout<<obj.get_nickname()<<"says"<<obj.talk()<<std::endl;}
  • 2022-11-30实验5
    task4:pets.hpp:#pragmaonce#include<iostream>#include<string>usingnamespacestd;classMachinePets{public:MachinePets(){}MachinePets(consts
  • 2022-11-27实验五
    task4Pets.hpp1#pragmaonce2#include<bits/stdc++.h>3usingnamespacestd;4classMachinePets5{6private:7stringnickname;8public:9