Re: template and typedef
On 2008-02-21 05:05:38 -0500, Berardino la Torre
<berardino.latorre@hotmail.com> said:
> Hi All,
>
> is it possible to do something like this ? :
>
> template <typename Base>
> class Object : public Base::Interface {
> };
g++ seems to complain that you cannot inherit from an incomplete type Base.
This is interesting. Just when you think you've figured out how
template works, here comes another example showing you how much you
don't know.
>
> class IA{
> virtual void print()=0;
> };
>
> class A : public Object<A>{
> public:
> typedef IA A::Interface;
> void print(){
> }
> };
Seems like your goal is to have class A inherit from A::Interface. So,
why not consider the following:
class IA {};
class A : public IA
{
public:
typedef IA Interface;
};
>
>
> int main(){
>
> return 0;
> }
--
// kira
|