problems with extended classes and overwrite with methods

Posted by Marco on Stack Overflow See other posts from Stack Overflow or by Marco
Published on 2010-06-09T12:04:09Z Indexed on 2010/06/09 12:12 UTC
Read the original article Hit count: 234

Filed under:
|
|
|
|

I have a .net website written in C# and will make functionalities that other developers can use. So i will make some default implementation and a developer can overwrite some methods

Example: i have a class ShoppingCart and a class Product the class product haves a method getProductPrice the shoppingcart will call the method getProductPrice for calculating the total price of cart

The Shoppingcart and Product are in the same project and i will give the developers the .dll so they can't change the source code so we can update the assembly later

So they need to make a other project and extend the product class and overwrite the method getProductPrice so they can implement there own logic The problem is that the shoppingcart will not call the extended method but the original

If we make already a extended project for the developers and the shoppingcart will call the extended method then we have a circular reference because the extended product needs a reference to product and the shopping cart to the extended product

partial classes also don't works because we only can use partials within the same assembly

anyone a suggestion ?

thanks in advance

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET