Re: Private constructor
From: Ron Natalie (ron_at_sensor.com)
Date: 12/20/03
- Next message: Jeff Schwab: "[Nit] Re: Private constructor"
- Previous message: Jeff Schwab: "Re: getline and substr"
- In reply to: Andy: "Re: Private constructor"
- Next in thread: Jeff Schwab: "[Nit] Re: Private constructor"
- Reply: Jeff Schwab: "[Nit] Re: Private constructor"
- Reply: Andy: "Re: Private constructor"
- Reply: Andy: "Re: Private constructor"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 20 Dec 2003 10:37:07 -0500
"Andy" <garth_rockett@yahoo.com> wrote in message
news:96dbbc80.0312200331.5098622c@posting.google.com...
> <
> I am sorry I made a stupid mistake. I was under the impression that
> just as static functions cannot access instance data members of a
> class, they also cannot call non-static member functions. Of course
> member functions are not per instance even if they are made to look
> that way. Constructor being a special kind of such a function should
> be accessible from static member functions.
> >
>
> That was stupider on second thoughts. A constructor does not get a
> this pointer secretly. So it's not a special kind of the others ... it
> is special and different from the rest. Nevertheless, I think I am
> right in assuming that neither the member functions nor the
> constructor or destructor constitute the state of an instantiated
> object - therefore static member functions should be able to access
> them
I have no clue what you are talking about. Constructors are non-static
member functions. You can't call them. They do have this pointers.
You're confusing access with instantiation. A static member function
has access to the private members of other objects of the same class
just like non-static members of one object can access private
members of other instances of the class.
- Next message: Jeff Schwab: "[Nit] Re: Private constructor"
- Previous message: Jeff Schwab: "Re: getline and substr"
- In reply to: Andy: "Re: Private constructor"
- Next in thread: Jeff Schwab: "[Nit] Re: Private constructor"
- Reply: Jeff Schwab: "[Nit] Re: Private constructor"
- Reply: Andy: "Re: Private constructor"
- Reply: Andy: "Re: Private constructor"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|