Discussion: template and typedef
Afficher un message
Vieux 22/02/2008, 11h24   #6
James Kanze
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: template and typedef

On Feb 21, 8:57 pm, Jeff Schwab <j...@schwabcenter.com> wrote:
> Berardino la Torre wrote:
> > is it possible to do something like this ? :


[Berardino's original post isn't showing up here, but...]

> [Summarized for brevity:]


> template <typename Base>
> struct Object: Base::Interface { };


This line isn't legal C++. What it almost certainly should be
is:

struct Object : typename Base::Interface {} ;


> struct IA { virtual void print() =0; };


> struct A: Object<A> {
> typedef IA A::Interface;
> void print() { }
> };


> You're trying to derive a class (indirectly) from a type
> defined within that class.


Which is impossible, templates or not.

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
  Réponse avec citation
 
Page generated in 0,06274 seconds with 9 queries