D - class construction bug?
- Sean Kelly (14/14) Feb 24 2004 I just tried this:
- Kris (4/18) Feb 24 2004 Attributes are apparently applied at the module-level, rather than the
- J Anderson (4/33) Feb 24 2004 --
- Sean Kelly (4/5) Feb 24 2004 Hm. So how would I go about creating a singleton or other class that
- J Anderson (7/13) Feb 24 2004 I'm not exactly sure what you mean by special construction
- Sean Kelly (4/9) Feb 24 2004 Thanks. As for special construction requirements, I think that could
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.That is not true in this situation. Constructors are always public."Sean Kelly" <sean ffwd.cx> wrote in message news:c1ga1h$1c3d$1 digitaldaemon.com...-- -Anderson: http://badmama.com.au/~anderson/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
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: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/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
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