Re: Creating thread from a class object
- From: "Rob Vermeulen" <rvermeulen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 11 Jan 2007 14:10:41 +0100
"Ben Voigt" <rbv@xxxxxxxxxxxxx> wrote in message
news:eikK2mONHHA.3944@xxxxxxxxxxxxxxxxxxxxxxx
Not at all. Any class member function, whether static or not, has full
privilege to access private members, including static member functions and
data, and non-static member functions and data of any instance of the
class. The fact that non-static functions always know of at least one
instance (the this pointer) and static functions does not decrease the
ability of static functions to reach inside arguments, globals, and so
forth having that type and use all the private members.
While you might be able to implement stream insertion operators (ie cout
<< o) using only the public interface, the fact is that static member
functions can use the private interface as well.
Ben,
Thanks for your reply. :-)
I meant exactly what you are saying here.
If a static function receives a pointer to an instance of its own class, it
has access to its private members though that pointer.
And that IS an advantage when using a static member function as a thread
proc.
Rgrds,
Rob.
.
- References:
- Creating thread from a class object
- From: Ham Pastrami
- Re: Creating thread from a class object
- From: David Lowndes
- Re: Creating thread from a class object
- From: Rob Vermeulen
- Re: Creating thread from a class object
- From: David Lowndes
- Re: Creating thread from a class object
- From: Ben Voigt
- Creating thread from a class object
- Prev by Date: Re: Is it possible to get function pointer to class constructor?
- Next by Date: Re: Creating thread from a class object
- Previous by thread: Re: Creating thread from a class object
- Next by thread: STL binary_function in VS 2005
- Index(es):
Relevant Pages
|