what is virtual function?
Answer Posted / varun sir
a virtual function is used to avoid duplicacy in derived
classes. suppose that there is a base class which has two
properties a and b. now suppose that two derived classes
named 'der1' and 'der2' are deriving from that base class,
then both properties a and b of base class will be
inherited to both of the derived classes. now if a new
class is derived from 'der1' and 'der2' then both of the
properties a and b of 'der1' and 'der2' will also be
inherited into newly derived class. this will cause
duplicacy in newly obtained derived class. so in order to
avoid this duplicacy , we use virtual functions.
| Is This Answer Correct ? | 8 Yes | 6 No |
Post New Answer View All Answers
Why do we use oop?
What does and I oop and sksksk mean?
What are the 4 main oop principles?
What is class encapsulation?
any one please tell me the purpose of operator overloading
What is polymorphism and why is it important?
What is cohesion in oop?
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
Can we define a class within the interface?
What are the important components of cohesion?
What is class in oop with example?
What is the advantage of oop over procedural language?
What is the purpose of enum?
What are two types of polymorphism?
What is byval and byref? What are differences between them?