多型與虛函式程式設計題 3(C 程式設計第6周)

2021-07-09 03:13:10 字數 956 閱讀 8359

問題描述

下面的程式輸出結果是:

a::fun

a::do

a::fun

c::do

請填空:

#include 

using

namespace

std;

class a

virtual

void do()

};class b:public a

};class c:public b

void fun()

};void call(

// 在此處補充你的**

) int main()

輸入

輸出

a::fun

a::do

a::fun

c::do

樣例輸入

樣例輸出

a::fun

a::do

a::fun

c::do

提示

提交作業時只提交補充的**

原始碼

#include 

using

namespace

std;

class a

virtual

void do()

};class b:public a

};class c:public b

void fun()

};void call(

// 在此處補充你的**

a* p

) int main()

多型與虛函式 程式設計題 1 C 程式設計第6周

注意 總時間限制 1000ms 記憶體限制 65536kb 下面程式的輸出結果是 a fun c do 請填空 123 4567 89 1011 1213 1415 1617 1819 2021 2223 2425 2627 2829 3031 32 include using namespace ...

類與物件程式設計題3(C 程式設計第3周)

問題描述 下面程式的輸出結果是 5,55,5 請填空 include using namespace std class base class big int main 輸入無 輸出 5,55,5樣例輸入 無樣例輸出 5,5 5,5提示 1.所缺 具有如下形式 big big 2.提交作業時只提交補...

STL程式設計題3(C 程式設計第9周)

描述 現有一整數集 允許有重複元素 初始為空。我們定義如下操作 add x 把x加入集合 del x 把集合中所有與x相等的元素刪除 ask x 對集合中元素x的情況詢問 對每種操作,我們要求進行如下輸出。add 輸出操作後集合中x的個數 del 輸出操作前集合中x的個數 ask 先輸出0或1表示x...