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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -