Visual ++ print from main with inheritance on visual form in listbox -
i´ve made "main" class lets call a(veichle), , have 2 classes inherits lets call them b(car) , c(mc). have handler lets call "d" binds a,b , c. have form1 class lets call e(visual)
i want print out private members on visual form "e" in listbox
if try ex)
this->listbox1->items->add(x.veichles[i]->getbrand());
it complains veichles private member in d.
how can around that?
the private means access not allowed other classes.
you should create public accessor function. example, getvehiclebyindex(int idx)
.
your code this:
a* pvehicle = x.getvehiclebyindex(i); if (pvehicle) // assuming null indicates error add(pvehicle->getbrand()); else // react on error
Comments
Post a Comment