#include <iostream>
using namespace std;
class CObject
{
public:
void ExecuteDeb(int num)
{
printf("Printing! %i ", num);
}
};
class CObjectLinker
{
public:
CObject* objs;
int numObjs;
CObjectLinker(int num)
{
numObjs = num;
objs = new CObject[numObjs];
}
void StartExecute()
{
int number = numObjs;
keepExecuting(number);
}
void keepExecuting(int& curNum)
{
objs[curNum].ExecuteDeb(curNum);
curNum--;
if(curNum < 0)
return;
keepExecuting(curNum);
}
};
int main(int argc, char *argv[]) {
CObjectLinker linker(4);
linker.StartExecute();
}
Might not be of interest but something.You must log in to post a comment. You can login or register a new account.
Best to use a for loop in this scenario.