Q:

Can virtual functions be inlined in c++?

0

Can virtual functions be inlined?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

Whenever a virtual function is called using a base class reference or pointer it cannot be inlined (because the call is resolved at runtime), but whenever called using the object (without reference or pointer) of that class, can be inlined because the compiler knows the exact class of the object at compile time.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions For Experienced

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Can a virtual function is called inside a non-virt... >>
<< Is there a separate vtable for each object?...