Interfaces and Abstract Classes

Feb 21 2007 12:11 PM

Hi,

I really should know why this isn't working, but for some reason I can't figure it out :). I have a class... BusinessEntityBase.cs ... and then a bunch of Business Objects that inherit from it. Let's say User.cs for example.

In a separate namespace I have created an interface called IEntityManagement. It has 4 methods (CRUD) Create, Read, Update, Delete and uses the BusinessEntityBase object for parameters and return types (where required).

I then created a class called UserManager.cs that implements the IEntityManagement interface. Rather than use the BusinessEntityBase object in my parameters and return types, I am using the specific business entity. So for example... where the interface says:

BusinessEntityBase Create();

the UserManager class has...

User Create();

Problem is that I am getting compilation errors saying that I have not defined the methods. I thought, since the user class inherits the BusinessEntityBase class that it means that to the compiler a User is a BusinessEntityBase.

Why can't I use the specific business entity when defining the implementation of the interface methods?

A.


Answers (2)