Writing a function in a .h file and its implementation right after (implicit inline), while using the virtual keyword:
virtual void g(){cout<<"is Inline?"};
Is the virtual functionality meaningless because the function is implemented in the .h?
Is this considered to be an inline?
No.
virtualandinlineare completely independent concepts.virtualmeans that the function to call is chosen, at run-time if necessary, according to the dynamic type of the object it’s invoked on.inlinemeans that you’re allowed to define the function in more than one translation unit, and must define it in any translation unit that uses it. This is necessary (for some compilers) to allow the function to be inlined, but does not force all calls to be inlined. In particular, virtual calls usually won’t be inlined (unless the dynamic type can be determined at compile time), sovirtualwill certainly retain its meaning here.Yes, but (as mentioned above) that does not mean that all calls will be inlined.