Facing problems with Class Properties

d coder dlang.coder at gmail.com
Fri Dec 10 17:01:44 PST 2010


> Is there a reason you can't directly reference the members?  After all, you
> are writing the class.
>

Thanks Steve for your inputs.

Actually this is part of a bigger code that I am trying to create.
Though I am pretty new to D.

What I have posted is a reduced code that illustrated the issue I am
facing. In the actual code, I am using string mixins and there are too
many classes (all derived from BaseClass) and too many class
instances, and the constructor call for Bar (and other classes) is a
bit more involved. There is a need to make sure that all the
constructors are called in a seamless fashion.

In fact, I will not be the end-user. I would just be coding the
BaseClass and the mixin. The actual end-users are not supposed to be
quite D-literate and I would be asking them to code something to the
effect:

class Foo: BaseClass {
  mixin(CreateInstances());
  // Define your Bar and other sub-class instances here
  //...
  // More code here
}

Any ideas?

Regards
- Cherry


More information about the Digitalmars-d-learn mailing list