Is it possible to pass a pointer to a type as an argument to a function?
e.g.
Or something like that??Code:void Function(void *type)
{
type Variable;
}
Printable View
Is it possible to pass a pointer to a type as an argument to a function?
e.g.
Or something like that??Code:void Function(void *type)
{
type Variable;
}
One solution is an object factory as Andrei Alexandrescu describes in Modern C++ Design.
The code above is an example and requires much more modifications to solve your problem. Nonetheless, the concept is the same.Code:typeplate <typename T, typename U>
class A
{
...
T * CreateObject();
};
Kuphryn
This seems to work:
Code:template<class T>
void Function(const T& obj)
{
T innerobj;
// ... Other Stuff
}
Cheers guys, I have a look :-)
dt