CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Nov 2005
    Posts
    102

    non-static member of outer type

    Hey, i get the following error when i try to compile my project:

    Cannot access a non-static member of outer type 'Project.Shader' via nested type 'Project.Shader.RenderSurfaceSet'.

    What i'm doing is the following.
    I have a class called worldView.cs, in that class i create the Shader class like so:

    [Inside worldView.cs]
    Code:
    Shader shader = new Shader(this);
    As you can see a pass an instance of the worldView class to the shader class. The shader class uses some variabled declared in the worldView class without a problem.
    But here comes the issue:

    In the Shader.cs class i also have a struct defined inside the class, like so:

    Code:
        public class Shader
        {
            public View.WorldView world;
    
            RenderSurfaceSet[] downscaledSets;
    
            public Shader(View.WorldView world)
            {
                this.world = world;
                Initialize();
            }
    
            //some functions inside the class
    
            //the struct
            struct RenderSurfaceSet
            {
                //some variables here
    
                public RenderSurfaceSet(int downscalingFactor, int sourceTexture)
                {
                    //code in constrcutor
                }
                //and some other functions inside this struct
            }
    }
    Now what i'm trying to do is also use the worldView instance inside this struct. The worldView object seems to be accessible from within that struct, but when i try to compile it it generates that error.

    Anyone any idea how to solve that??
    Last edited by vivendi; October 8th, 2009 at 03:10 AM.

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