急求这几道c++题的答案,英文更佳

急求这几道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 ->.
ss77585921 1年前 已收到1个回答 举报

jackammy 幼苗

共回答了18个问题采纳率:94.4% 举报

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
人格保证是纯手工打造~第二题可能还要再详细些...

1年前

4
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.016 s. - webmaster@yulucn.com