Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interface with base class
Message
From
04/08/2009 13:32:49
 
 
To
All
General information
Forum:
ASP.NET
Category:
Object Oriented Programming
Title:
Interface with base class
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01416072
Message ID:
01416072
Views:
132
I thought I'd used this sort of construct before. But the compiler insists that the type of Parent in Test must be BaseClass.
public interface ITest
    {
        BaseClass Parent { get; }
    }

    public class BaseClass {}

    public class DerivedClass : BaseClass{}

    public class Test : ITest
    {
        public DerivedClass Parent
        {
            get {return new DerivedClass(); }
        }
    }
Am I cracking up?
Next
Reply
Map
View

Click here to load this message in the networking platform