getting a classes array
Jarrett Billingsley
kb3ctd2 at yahoo.com
Sat May 3 07:39:07 PDT 2008
"lurker" <lurker at lurker.com> wrote in message
news:fvgv7p$1gu7$1 at digitalmars.com...
> void Reset() {
> for(int i = 0; i < 20; i++)
> mVector[i] = 0;
> }
> }
Slicing is fun. That loop can be replaced with "mVector[] = 0;"
> class B {
> private:
> A aa = new A;
This line doesn't even compile. You can't use a 'new' expression to
initialize a member like in Java/C#.
A aa;
this()
{
aa = new A;
}
> bool test() {
> ....
> do some stuff
> int i = somefunction(aa.Self());
> if(aa.StatusErrors())
> return false;
> aa.Reset(); <------ crashes here
> int i = somefunction1(aa.Self());
> if(aa.StatusErrors())
> return false;
> }
> }
The only error I get when I run this code is an assertion at the end of
test() saying that it's missing a return. You'll only get that error if you
compile with -debug though. I don't get any error upon calling Reset.
More information about the Digitalmars-d-learn
mailing list