Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Inline virtual method

Reply
Thread Tools

Inline virtual method

 
 
olegerm
Guest
Posts: n/a
 
      09-23-2004
Does anybody know can a virtual method be inline?
Please explain.
Thank you.
 
Reply With Quote
 
 
 
 
Sharad Kala
Guest
Posts: n/a
 
      09-23-2004

"olegerm" <(E-Mail Removed)> wrote in message

> Does anybody know can a virtual method be inline?


Of course, it can.

> Please explain.


If you invoke a virtual member function on an entity whose dynamic type is
known to compiler then it can go ahead and inline it. E.g. when you invoke
it on an object (and not base class pointer/reference), then compiler knows
the static and dynamic types and can inline the call, of course if it wishes
to do so!

Sharad


 
Reply With Quote
 
 
 
 
olegerm
Guest
Posts: n/a
 
      09-23-2004
Thank you.

"Sharad Kala" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> "olegerm" <(E-Mail Removed)> wrote in message
>
> > Does anybody know can a virtual method be inline?

>
> Of course, it can.
>
> > Please explain.

>
> If you invoke a virtual member function on an entity whose dynamic type is
> known to compiler then it can go ahead and inline it. E.g. when you invoke
> it on an object (and not base class pointer/reference), then compiler knows
> the static and dynamic types and can inline the call, of course if it wishes
> to do so!
>
> Sharad

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tool which expands implicitly inline inline functions tthunder@gmx.de C++ 3 06-16-2005 12:54 AM
To inline or not to inline? Alvin C++ 7 05-06-2005 03:04 PM
I see no difference in an inheirited non-virtual method and an inheirited virtual method jlopes C++ 7 11-19-2004 07:47 PM
External inline functions calling internal inline functions Daniel Vallstrom C Programming 2 11-21-2003 01:57 PM
inline or not to inline in C++ Abhi C++ 2 07-03-2003 12:07 AM



Advertisments