Hi guys im a little stuck atm and wonder if anyone could help me
I have a base abstract class and 3 classes that all inherit from it. These 3 classes are all different of course.
Now what i would like to do is to use an array of the baseclass to use overloaded functions from the derived classes.
My code compiles and runs but it doesnt call the derived functions it uses the abstract base class functions(i assume it does as the derived functions output dosent happen).
I may of done something wrong this is sort of how my code goes.
I had compile issues before so i added theCode:class bass { virtual void somefn()=0 {}; }// this isnt my actual class :) class a { virtual void somefn() } //ect ect a Aclass; b Bclass; c Cclass; base myarray[3] = {Aclass,Bclass,Cclass}; myarray[0].somefn(); //in my program this doesnt work how id like it toand now it compiles i can post the code but its spread over a few files.Code:{}
Sorry if i havent provided enough information im just thinking if somebody could give me an example of creating an array of type base with 3 different derived class objects in it and how to call its functions. yeah i know i dont ask for much
Thanks in advanced



LinkBack URL
About LinkBacks



