I’m new to C++ and I don’t know about template class but I think I can use template for my problem. I have two classes,
class Foo
{
public:
Foo (int a, char b);
};
class Bar
{
public:
Bar (int a);
};
And these classes are not related to each other.
My question is, is it possible to create a template class to create instances of Foo and Bar? Something that could be used like this:
TemplateClass<Foo>::createClass();
But I’m not sure about the parameter.
You can use C++11 for this.
Or with C++03 use different overloads.
And so on…