早教吧作业答案频道 -->其他-->
急求这几道c++题的答案,英文更佳1.WhatdoesinheritancemeaninC++?SupposeyouhaveclassAandclassB,underwhichofthefollowingtwoconditionsclassBshouldinheritfromclass(1)AisapartofB.(2)BisakindofA.2.Whens
题目详情
急求这几道c++题的答案,英文更佳
1.What does inheritance mean in C++?Suppose you have class A and class B,under which of the following two conditions class B should inherit from class
(1)A is a part of B.
(2)B is a kind of A.
2.When should the keyword virtual be placed before a member function of a class?Do all of the virtual member functions have to be overridden in the derived class?If not,why?
3.Does C++ support multiple inheritance?Some people think that multiple inheritance can cause a variety of ambiguity problems.Try to explain what problems will multiple inheritance cause and how to avoid them.
4.What operators cannot be overloaded in C++?What restriction applies to overloading the following operators?
=,( ),[ ],and ->.
1.What does inheritance mean in C++?Suppose you have class A and class B,under which of the following two conditions class B should inherit from class
(1)A is a part of B.
(2)B is a kind of A.
2.When should the keyword virtual be placed before a member function of a class?Do all of the virtual member functions have to be overridden in the derived class?If not,why?
3.Does C++ support multiple inheritance?Some people think that multiple inheritance can cause a variety of ambiguity problems.Try to explain what problems will multiple inheritance cause and how to avoid them.
4.What operators cannot be overloaded in C++?What restriction applies to overloading the following operators?
=,( ),[ ],and ->.
▼优质解答
答案和解析
1.Inheritance allows one data type to acquire properties of other data types.
the 2nd condition (B is a kind of A)
2.(1)When a class is having serveral base classes and the call of member function is ambigious.
(2)No,there is no need to override when it is not needed.
3.Yes.When the inherited class is using a member function or member varible which exists in more than one base classes,the computer will not know which one to use.The problem can be simply solved by using the operator '::' or define a virtual inheritance.
4.“.” “::” :” and “sizeof” can not be overloaded.
the overloading of the operator mentioned can only be defined as a member function of a class
人格保证是纯手工打造~第二题可能还要再详细些...
the 2nd condition (B is a kind of A)
2.(1)When a class is having serveral base classes and the call of member function is ambigious.
(2)No,there is no need to override when it is not needed.
3.Yes.When the inherited class is using a member function or member varible which exists in more than one base classes,the computer will not know which one to use.The problem can be simply solved by using the operator '::' or define a virtual inheritance.
4.“.” “::” :” and “sizeof” can not be overloaded.
the overloading of the operator mentioned can only be defined as a member function of a class
人格保证是纯手工打造~第二题可能还要再详细些...
看了 急求这几道c++题的答案,英...的网友还看了以下:
若f(x)=log2(1+ax/x-1)是奇函数,求实数a的值.改动原答案时请在原题改动,因为本手 2020-04-06 …
大家帮忙看看这几道数字推理题,我实在是做不出来了1.711131719314741()答案5A63 2020-04-27 …
高等数学中x的n次方求和怎么算(n从1到正无穷,不是1到n)答案是1/(1-x),我想要过程还有x 2020-05-14 …
任何充分大的偶数都可以写成一个质数加上不超过两个质数的乘积的形式通常称为“”答案1:1+2答案二2 2020-06-02 …
若直线y=ax-1(a∈R)与焦点在x轴上的椭圆x²/5+y²/m=1总有公共点,则m的取值范围答 2020-06-06 …
概率问题四选一得单选题,某学生知道答案的概率是2/3,若不知道答案,那么其猜对的答案的概率是1/4 2020-06-20 …
已知5个汽水瓶子可以换1瓶汽水,某班同学喝了161瓶汽水,其中有些是喝剩下的空瓶子换的,那么他们至 2020-06-22 …
4x+8x^3+1+2x^2如何求得答案(4x+1)(2x-1)9(x-1)^2-25(x+1)^2 2020-10-31 …
(-1)^(-1/2)=?i还是-i?为啥如果先算-1的-1次方(这一步得到答案为-1)再继续算其的 2020-11-01 …
智力问答,纯属送分!1+1=?一共有几种答案(属于脑筋急转弯,不按正常回答,错误回答:1)因本题只有 2021-01-01 …