using this in static member function

T

Tony Johansson

Hello Experts!!

I wonder if you use this within a static member function what does it mean
because you can call a static member function without having an object.

If you have instansited an object and you call a member function within that
object it's make sense to use this in that member function.

//Tony
 
N

Niels Dybdahl

I wonder if you use this within a static member function what does it mean
because you can call a static member function without having an object.

If you have instansited an object and you call a member function within that
object it's make sense to use this in that member function.

The difference between a static and a non-static function is whether it has
a this pointer or not. So you can not.

Niels Dybdahl
 
R

Rolf Magnus

Tony said:
Hello Experts!!

I wonder if you use this within a static member function what does it mean
because you can call a static member function without having an object.

It means nothing. There is no this pointer. That's what 'static' in this
context is all about.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,968
Members
47,524
Latest member
ecomwebdesign

Latest Threads

Top