Hi, I had a discussion with my friend asking why there is no built-in virtual function.
My answer is a built-in function at compile time, and a virtual function is mandatory in dynamic time. At compile time, it is not possible to know which function will call the virtual function. Therefore, the built-in virtual function is not a good idea.
However, he said that was not right.
His answer to the inline function has no address, so there is no way in the virtual table to put the address of the inline function, so there is no inline virtual function.
I would like to know three points:
- Is my answer correct? I think my answer is right.
- Does the built-in function have no address? I think he has an address;
- even the built-in function has an address, is its answer better than mine?
Thank you very much!
source share