I'm doing a higher complex system for a company. I have the assignment to keep one loop for each (Draw, Update). However their system requires me to extend the base class for the different calculations; and there will be several extenders. What i did to test this was ->
struct base_line
{
template<typename a> bool operator+=(a b){bs[0] = b;}
virtual void foo(){}
base_line *bs[2];
};
struct base : base_line
{
virtual void foo(){
printf("Nice\n");
}
};
base_line bse;
base bser;
int _tmain(int argc, _TCHAR* argv[])
{
bse+=bser;
while(true)
{
if(bse.bs[0]){
bse.bs[0]->foo();
}
}
return 0;
}
however ofcourse you cannot convert from base to base_line *. Which basically ruins what i am trying to accomplish; The code previously shown is supposed to launch the virtual foo(); printing Nice\n. Does anyone know how i can accomplish this?