Computer Science, asked by AAFT53, 1 year ago

Which of the following statements about virtual base classes is correct?

A.It is used to provide multiple inheritance.
B.It is used to avoid multiple copies of base class in derived class.
C.It is used to allow multiple copies of base class in a derived class.
D.It allows private members of the base class to be inherited in the derived class.

Answers

Answered by Anonymous
4
ʜɪɪ ᴅᴇᴀʀ ɢᴏᴏᴅ ᴇᴠᴇɴɪɴɢ...

✔✔✔✔✔✔✔✔✔✔✔

ʙ.ɪᴛ ɪs ᴜsᴇᴅ ᴛᴏ ᴀᴠᴏɪᴅ ᴍᴜʟᴛɪᴘʟᴇ ᴄᴏᴘɪᴇs ᴏғ ʙᴀsᴇ ᴄʟᴀss ɪɴ ᴅᴇʀɪᴠᴇᴅ ᴄʟᴀss.

ᴄᴏʀʀᴇᴄᴛ ᴀɴꜱᴡᴇʀ ....

❤❤❤❤❤❤❤❤❤❤❤
Answered by varshamittal029
0

Answer: Option (b) is correct.

Concept:

When employing multiple inheritances, virtual base classes are used to avoid numerous instances of the same class from appearing in the hierarchy.

Explanation:

When two or more objects are derived from the same base class, we can avoid multiple copies of the base class from appearing in an object derived from those objects by defining the base class as virtual when it is inherited. This type of base class is referred to as a virtual base class.

When employing multiple inheritance, virtual base classes are used to prevent several "instances" of a particular class from appearing in an inheritance hierarchy.

Hence option (b) is the correct answer.

A virtual base class is used to avoid multiple copies of base class in the derived class.

Similar questions