• Advertisement
Sign in to follow this  

Nested class forward declarations

This topic is 4356 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible to do something like the following:
template<class A> class Foo {}

class Bar : public Foo<Bar::Baz>
{
public:
  class Baz {};
};

This doesn't seem like an unreasonable thing to do, but there doesn't seem to be any way of doing it. Of course I could move Baz into global scope (which is what I'm about to do), but I'm curious if there is a way of doing this or a good reason why it can't be done.

Share this post


Link to post
Share on other sites
Advertisement
There is something that get's close to that:


template <class Type>
class A
{ };

class B_aux
{
public:
class C { };
};

class B : public B_aux, public A<B_aux::C>
{ };




I mean... if you need class C to be private, I don't know how. Besides, this method is basically the same as declaring class C as global.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement