void Workflow::Define(constchar * tip,int broj)
{
int s=0;
int i;
int f=0;
if (0==strcmp(tip,"Activity"))
s = 1;
if (0 == strcmp(tip, "State"))
s = 2;
while ((s == 1) && (provera < duz) && (f<broj))
{
p[provera] = new Activity;
provera++;
f++;
p[provera] = new State;
}
while ((s == 2)&&( provera < duz) && (f<broj))
{
provera++;
f++;
}
}
Yes,i read about deep copy.I have corrected that im my code
1 2 3 4 5 6 7 8 9 10 11 12
Workflow::Workflow(const Workflow & w)
{
duz = w.duz;
if (w.p)
{
p = new Step*[duz];
for (int i = 0; i < duz; i++)
p[i] = w.p[i];
}
else
p = 0;
}
I am using Steps only to achieve polimorphism because that is our task:Ussualy we have array of Pointers to some object and we are meant to achieve polymorphism.