A
amir
Here's a scenario:
MainObject
{
ObjectB myB;
myB = new ObjectB(P, true);
}
ObjectA
{
variable v1;
variable v2;
ObjectA(param P)
{
v1 = P.something;
v2 = P.somethingelse;
}
}
ObjectB: ObjectA
{
ObjectC myC;
ObjectB(param P, bool check) : base(P)
{
if(check)
myC = new ObjectC(P);
}
}
ObjectC : ObjectB
{
constructorObjectC(param P): (base P)
{
}
}
==================
I am trying to do the above but I am getting errors. I want to create Object
C only if the boolean is true and not create it otherwise. How can I go about
doing this?
Thanks in advance for your help.
MainObject
{
ObjectB myB;
myB = new ObjectB(P, true);
}
ObjectA
{
variable v1;
variable v2;
ObjectA(param P)
{
v1 = P.something;
v2 = P.somethingelse;
}
}
ObjectB: ObjectA
{
ObjectC myC;
ObjectB(param P, bool check) : base(P)
{
if(check)
myC = new ObjectC(P);
}
}
ObjectC : ObjectB
{
constructorObjectC(param P): (base P)
{
}
}
==================
I am trying to do the above but I am getting errors. I want to create Object
C only if the boolean is true and not create it otherwise. How can I go about
doing this?
Thanks in advance for your help.