F
f.f
class A
{
....
};
class B : public A
{
....
};
class C : public A
{
....
};
T* createObject()
{
T* ptr = new T();
return ptr;
}
I wanna use createObject() to create object instance of either class B
or class C?
What approach should I use? Should I use template?
f.f
{
....
};
class B : public A
{
....
};
class C : public A
{
....
};
T* createObject()
{
T* ptr = new T();
return ptr;
}
I wanna use createObject() to create object instance of either class B
or class C?
What approach should I use? Should I use template?
f.f