473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Inline virtual method

Does anybody know can a virtual method be inline?
Please explain.
Thank you.
Jul 22 '05 #1
2 2294

"olegerm" <ol********@yandex.ru> 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
Jul 22 '05 #2
Thank you.

"Sharad Kala" <no******************@yahoo.com> wrote in message news:<2r*************@uni-berlin.de>...
"olegerm" <ol********@yandex.ru> 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

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: qazmlp | last post by:
My class in a header file, contains inline virtual destructor. Is this Ok? Can it cause any problems? class base { public: base() { } virtual ~base { std::cout<<"Inside virtual destructor\n";...
15
by: Dave Townsend | last post by:
Yo, I had a job interview today, the interviewing asked me about inline virtual functions, or what was my opinion on them. Hm, I've seen mention of these babies in the reference material, but...
43
by: Patrick Laurent | last post by:
Hello I have a program with many many inlined template functions It is essential for the execution speed that every (or almost every) function marked as inlined, becomes really inlined by the...
6
by: RainBow | last post by:
Greetings!! I introduced the so-called "thin-template" pattern for controlling the code bloat caused due to template usage. However, one of the functions in the template happens to be virtual...
8
by: John Ratliff | last post by:
Can the compiler ever inline a method when there is a pointer to the member used? Thanks, --John Ratliff
3
by: shuisheng | last post by:
Dear All, If I define a virtual function to be inline, is it really inline? Or it is inline in some cases, and not in other cases. Would you please help me to look at the following case. ...
8
by: siddhu | last post by:
Dear experts, A virtual function has to have an address. So if an inline virtual function is actually inlined then in that case what does address of this function signify? How does compiler know...
5
by: sunil | last post by:
Hello, I have a class deriving from a class that provides ability to serialize/deserialize objects over the network. There are two classes Requests (sent from client to server) Response(sent from...
5
by: .rhavin grobert | last post by:
if you have class Base { virtual inline bool foo() {return false;}; }; class Derived: public Base { virtual bool foo(); };
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.