Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interface inheritance
Message
General information
Forum:
ASP.NET
Category:
Class design
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01191305
Message ID:
01191401
Views:
7
Hi,

You should just mark the relevant methods as abstract in the abstract class. That way any sub-class must explicitly implement the method. Eg.
    public abstract class Test 
    {
        protected abstract int LoadPageData();
       
   }

    public class Test2 : Test
    {
    }
The above will not compile unless the LoadPageData() method is implemented in Test2.....

HTH,
Viv


>Hello Viv, I'm probably going about this the wrong way but !, what I'm trying to achieve is to force subclasses of my TabPage class to implement some methods ( i.e. the three shown in my code ) and I thought an Interface was the way to go , but if I have to mark the methods as virtual in my base class to get rid of the compiler warning ( I know it's there for a reason :-) ), I lose the power to force the imlementation of the methods in the subclasses. I suppose I could dispense with the the abstract base class and inherit directly from my base tab class every time and implement the interface on every subclass (ugh !!) any ideas ?
Previous
Reply
Map
View

Click here to load this message in the networking platform