-
June 14th, 2010, 03:55 AM
#1
[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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|