D - class construction bug?
- Sean Kelly <sean ffwd.cx> Feb 24 2004
- "Kris" <someidiot earthlink.net> Feb 24 2004
- J Anderson <REMOVEanderson badmama.com.au> Feb 24 2004
- Sean Kelly <sean ffwd.cx> Feb 24 2004
- J Anderson <REMOVEanderson badmama.com.au> Feb 24 2004
- Sean Kelly <sean ffwd.cx> Feb 24 2004
I just tried this:
class A
{
protected:
this() { printf( "ctor\n" ); }
}
int main()
{
A a = new A();
}
And it compiled and, when run, printed: "ctor." Is the "protected"
keyword not working correctly or is there some rule that class
constructors are inherently public?
Sean
Feb 24 2004
Attributes are apparently applied at the module-level, rather than the class-level. "Sean Kelly" <sean ffwd.cx> wrote in message news:c1ga1h$1c3d$1 digitaldaemon.com...I just tried this: class A { protected: this() { printf( "ctor\n" ); } } int main() { A a = new A(); } And it compiled and, when run, printed: "ctor." Is the "protected" keyword not working correctly or is there some rule that class constructors are inherently public? Sean
Feb 24 2004
Kris wrote:Attributes are apparently applied at the module-level, rather than the class-level.
"Sean Kelly" <sean ffwd.cx> wrote in message news:c1ga1h$1c3d$1 digitaldaemon.com...I just tried this: class A { protected: this() { printf( "ctor\n" ); } } int main() { A a = new A(); } And it compiled and, when run, printed: "ctor." Is the "protected" keyword not working correctly or is there some rule that class constructors are inherently public? Sean
-- -Anderson: http://badmama.com.au/~anderson/
Feb 24 2004
J Anderson wrote:That is not true in this situation. Constructors are always public.
Hm. So how would I go about creating a singleton or other class that has special construction requirements? Sean
Feb 24 2004
Sean Kelly wrote:J Anderson wrote:That is not true in this situation. Constructors are always public.
Hm. So how would I go about creating a singleton or other class that has special construction requirements? Sean
I'm not exactly sure what you mean by special construction requirements. There was a whole discussion on singletons before, so you might what to look at that (using module-level or static members were suggested). Search for singletons. -- -Anderson: http://badmama.com.au/~anderson/
Feb 24 2004
J Anderson wrote:I'm not exactly sure what you mean by special construction requirements. There was a whole discussion on singletons before, so you might what to look at that (using module-level or static members were suggested). Search for singletons.
Thanks. As for special construction requirements, I think that could all be handled by overloading "new." Just thinking out loud. Sean
Feb 24 2004








Sean Kelly <sean ffwd.cx>