0% found this document useful (0 votes)
9 views1 page

Understanding Virtual Functions in C++

Uploaded by

Prathamesh Patil
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Understanding Virtual Functions in C++

Uploaded by

Prathamesh Patil
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Virtual Function:

This concept is related to polymorphism in c++ and it includes another concepts


like 'early binding' and 'late binding'.

early binding= it is when any function in main section eg([Link]()) here compiler
sees who is calling the fun and what is the type of object which is calling fun.

late binding= it is done by the compiler when we have declared any func as virtual
and compiler sees only the content of the function caller that is [Link]() .Here
the compiler sees who is the parent of object 'obj' and runs the func 'fun' from
that parent

For this that func 'fun' should be written with prefix 'virtual'

You might also like