i am still learning and fighting derived classes.
tried something simple ( from the examples i have seen all over ):
public class BaseClass
{
public string Title {get;set;}
}
public class Channel : BaseClass
{
public string Path { get; set; }
}
Channel myChannel = new Channel();
myChannel.Title = "hello";
myChannel.Path = "123";
but i get an error on the myChannel.Path line saying BaseClass does not contain a definition for Path and no extension....
help me please, what am i doing wrong?
The example you show is fine. I think in your actual code you have:
so the answer is simply: ensure your local variable is typed as
Channel, since it is the the expression type (typically: the type of a variable) that determines the starting point for member resolution.As a terse alternative in C# 3: