G
GeeRay
Hi all,
how can I create a template class to decorate a type and use it as the
type itself?
For example:
I want to do this:
#include <iostream>
class A
{
public:
A(){};
virtual ~A(){};
void foo(){ std::cout << "foo" << std::endl;};
};
template<class T>
class B
{
public:
B(){};
virtual ~B(){};
operator T(){return instance;};
private:
T instance;
};
int main(int argn, char* argv[])
{
B<A> b();
b.foo();
}
Is it possible?
Thanks in advance.
how can I create a template class to decorate a type and use it as the
type itself?
For example:
I want to do this:
#include <iostream>
class A
{
public:
A(){};
virtual ~A(){};
void foo(){ std::cout << "foo" << std::endl;};
};
template<class T>
class B
{
public:
B(){};
virtual ~B(){};
operator T(){return instance;};
private:
T instance;
};
int main(int argn, char* argv[])
{
B<A> b();
b.foo();
}
Is it possible?
Thanks in advance.