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
What is a superclass in oop?
How do you answer polymorphism?
What does oop mean in snapchat?
Why is encapsulation used?
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.
Is this job good for future? can do this job post grduate student?
Can you explain polymorphism?
to find out the minimum of two integer number of two different classes using friend function
what is difference between class template and template class?
What is an example of genetic polymorphism?
What is meant by multiple inheritance?
write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.
What is for loop and its syntax?
What is a class in oop?
What are benefits of oop?