[RESOLVED] inheritance with name : base()
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: [RESOLVED] inheritance with name : base()

  1. #1
    Join Date
    Jun 2008

    [RESOLVED] inheritance with name : base()

    I am trying to access a List<> from the base class in a constructor of the derived class. It won't let me access it. Everything is marked public too.

    so why can't I access the list, but I can access the primitive types?

    Here is what I have...

    class BaseClass
    public int superSpecial;
    public List<connection> outputs;

    public BaseClass()
    outputs = new List<connection>();

    class DerivedClass : BaseClass
    int moreSpecial;

    public DerivedClass() : base()
    Console.WriteLine(base.superSpecial); // works: 0
    Console.WriteLine(base.superSpecial); // works: 0
    Console.WriteLine(base.outputs[4]); //"doesn't exist!"
    //... assume there is no index out of bounds error
    // vs intellisense won't let me write that


    ***************** NEVER MIND, PROBLEM SOLVED

    the solution was totally unrelated and everything up there is correct.
    Last edited by hotwheelharry; June 14th, 2010 at 03:58 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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)