ICode9

精准搜索请尝试: 精确搜索
  • 实验4 继承2021-12-01 15:01:47

    实验任务二 source code : 1 #include <iostream> 2 #include <typeinfo> 3 4 // definitation of Graph 5 class Graph 6 { 7 public: 8 void draw() { std::cout << "Graph::draw() : just as an interface\n"; } 9 }; 10 11 12

  • 实验42021-12-01 11:03:45

    task3 Battery.hpp #ifndef BATTERY_HPP #define BATTERY_HPP #include<bits/stdc++.h> using namespace std; class Battery { public: Battery(int a=70):capacity(a){} int get_capacity(){ return this->capacity; }

  • 11.242021-12-01 01:33:08

    #include<iostream> #include<iomanip> #include<string> using namespace std; class Car { public: Car(string maker, string model, int year) { this->maker = maker; this->model = model; this->year =

  • 实验四 继承2021-11-30 23:32:46

    #include <iostream> #include <typeinfo> // definitation of Graph class Graph { public: virtual void draw() { std::cout << "Graph::draw() : just as an interface\n"; } }; // definition of Rectangle, derived from Graph cla

  • 实验四 继承2021-11-30 19:32:06

    1 #include<iostream> 2 #include<string> 3 using namespace std; 4 class Car{ 5 public: 6 Car(string maker0,string model0,int year0,int odometers0=0):maker(maker0),model(model0),year(year0),odometers(odometers0){}; 7 void info()co

  • 实验四2021-11-27 20:00:59

    任务三 Battery.hpp #pragma once #include<iostream> using namespace std; class Battery { public: Battery(float n=70) :capacity{ n } {} float get_capacity() { return capacity; } ~Battery() = default; private: float capacity;

  • 实验42021-11-26 17:02:31

    #include <iostream> #include <typeinfo> // definitation of Graph class Graph { public: void draw() { std::cout << "Graph::draw() : just as an interface\n"; } }; // definition of Rectangle, derived from Graph class Recta

  • 【实验四】继承2021-11-26 16:35:23

    目录任务2任务3任务4 任务2 task2.cpp #include <iostream> #include <typeinfo> // definitation of Graph class Graph { public: void draw() { std::cout << "Graph::draw() : just as an interface\n"; } }; // definition of Rectangle, deri

  • 面向对象->实验报告四(C++)2021-11-25 01:32:06

    task3 题目要求 源码 main.cpp #include <iostream> #include "electricCar.hpp" int main() { using namespace std; // test class of Car Car oldcar("Audi", "a4", 2016); cout << "--------oldcar's info

  • 实验四 继承2021-11-24 23:32:19

    ------------恢复内容开始------------ //task2.cpp #include <iostream> #include <typeinfo> // definitation of Graph class Graph { public: void draw() { std::cout << "Graph::draw() : just as an interface\n"; } }; // definition

  • 实验四 继承2021-11-24 20:31:06

    实验任务三 1、Battery类: #include <iostream> #include <string> using namespace std; class Battery { private: int capacity; public: Battery(int capacity); ~Battery(); int get_capacity(); }; Battery::Battery(int capacity = 70) {

  • 实验4 继承2021-11-24 20:01:08

    实验任务3 "battery.hpp" 1 #ifndef TEST01_BATTERY_HPP 2 #define TEST01_BATTERY_HPP 3 4 #include <iostream> 5 using namespace std; 6 7 class Battery { 8 public: 9 Battery (int cap = 70): capacity(cap) {}; 10 int get_capacity(

  • 实验五2019-06-05 14:02:16

    1 2 3 #include<iostream>#include<string>#include<cstdlib>using namespace std;class MachinePets{public: MachinePets(const string s); virtual string talk() const=0; string getNickname(); virtual ~MachinePets(); private:

  • 实验五2019-06-04 13:02:15

    #include <iostream>#include<string>#include"MachinePets.h"#include "PetCats.h"#include "PetDogs.h"using namespace std;void play(MachinePets *p){ cout<<p->getNickname()<<" says "<<p-

  • 实验52019-06-04 13:00:48

    一 机械宠物 #include <iostream>#include "MachinePets.h"#include "Petcats.h"#include "Petdogs.h"using namespace std;void play(MachinePets *m){ cout<<m->getnickname()<<" say "<<m->talk()&

  • 实验五2019-06-04 12:49:45

    #include<string>#include<iostream>using namespace std;class MachinePets {public: MachinePets(const string s); virtual string talk()=0; string getNickname() { return nickname; }private: string nickname;};class PetCats:publ

  • 实验52019-06-03 23:45:01

    #include <iostream>#include <string>using namespace std;class MachinePets {public: MachinePets(const string s) :nickname(s) {} ; string getNickname(); virtual string talk() = 0;private: string nickname;};string MachinePets::getN

  • 实验52019-06-03 23:38:46

    #include<iostream>#include<string>using namespace std;class MachinePets{ public: MachinePets(){} MachinePets(const string s){ nikname=s; } string getNikname()const{return nikname;} virtual strin

  • 实验五2019-06-03 23:04:09

    //MachinePets.h#include<iostream>#include<string>using namespace std;#ifndef MACHINEPETS_H#define MACHINEPETS_Hclass MachinePets{public: MachinePets(const string s); virtual string talk() const=0; string getNickname();private: stri

  • 实验52019-06-03 20:43:37

    #include <iostream>#include <string>using namespace std;class MachinePets{public:    MachinePets(const string s):nickname(s){};    string getNickname() {return nickname;};    virtual string talk()=0;private:    string nickname;    };class P

  • 实验五 类的继承、派生和多态(2)2019-06-03 14:41:12

    一、验证性实验1. 在多层继承中,派生类中出现与基类同名成员时,通过对象名.成员名的方式,访问的成员什么?       对象名.成员名:派生类对象2. 通过基类指针访问派生类对象时,基类中成员函数有无关键字virtual,访问的成员分别是什么?        基类指针:有关键字时访问派生类,无关键

  • 实验五2019-06-03 12:50:44

    1 main.cpp #include <iostream>#include <string>using namespace std;#include "MachinePets.h"#include "PetCats.h"#include "PetDogs.h"void play(MachinePets *x){ cout<<x->getNickname()<<"says&qu

  • 实验5 类的继承、派生和多态(2)2019-06-03 12:39:29

    设计并实现一个机器宠物类MachinePets。 #include"petcats.h"#include"petdogs.h"#include"machinepets.h"#include<iostream>#include<string>using namespace std;void play(MachinePets *p){ cout<<p -> getNickname()<<

  • 实验五2019-06-02 15:01:04

    设计并实现一个机器宠物类MachinePets。 #include <iostream>#include <string>using namespace std;class MachinePets{ public: MachinePets(const string s):nickname(s){ } virtual string talk()=0; string getNickname(){ r

  • c++第五次实验2019-06-02 12:44:28

    part 1 两个问题: 1、派生类中出现与基类同名成员,通过对象名.成员名的方式,即代码中base2.display(),访问的成员是派生类中的成员 2、通过基类指针访问派生类对象时,在ex1_1.cpp中没有virtual,得到的结果全是基类成员函数的调用,在ex1_2.cpp中基类成员函数有virtual,结果基类派生类都依次

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有