CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    1

    Angry How to forward declare nested managed class in C++/clr

    OK, for the life of me, I can't find this answer. How can I forward declare a nested managed class? Here is an example of what I'm trying to accomplish:

    Code:
    namespace Geometry
    {
       ref class Vectors;
       ref class Points;
       // ref class Points::Point2;   <-- won't compile but this is the idea...
    
       public ref class Vectors
       {
       public:
          ref class Vector2
          {
          };
    
          void SomeFunc( Points::Point2 ^ );   //   <===== C2027
       };
    
       public ref class Points
       {
       public:
          ref class Point2
          {
          };
    
          void SomeFunc( Vectors::Vector2 ^ );
       };
    }

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: How to forward declare nested managed class in C++/clr

    This is common C++ restriction, not only C++/CLI: You can only give a forward declaration of a nested class within the outer class declaration.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured