Abstract class A has 4 virtual functions. Abstract class B defines only 2 of those member functions as it extends class

Lan Anh

New member
Abstract class A has 4 virtual functions. Abstract class B defines only 2 of those member functions as it extends class A. Class C extends class B and implements the other two member functions of class A. Choose the correct option below.
A. Program won’t run as all the methods are not defined by B
B. Program won’t run as C is not inheriting A directly
C. Program won’t run as multiple inheritance is used
D. Program runs correctly
 
Answer: d
Explanation: The program runs correctly. This is because even class B is abstract so it’s not mandatory to define all the virtual functions. Class C is not abstract but all the virtual functions have been implemented will that class.
 

Tìm kiếm

Back
Top