Passing derived objects in a constructure
- by Clarence Klopfstein
This is a bit of a convoluted question, hopefully I can make it clear.
I am finding that this may not be possible, but am trying to see if anybody has a solution.
I have four classes, two are core classes and two are those core classes extended:
extUser Extends coreUser
extSecurity Extends coreSecurity
In the constructor for coreUser you have this:
public coreUser(string id, ref coreSecurity cs)
When trying to extend coreUser you would have this:
public extUser(string id ref extSecurity es) : base(id, ref es)
This fails because es is of type, extSecurity and the base class expects a type of coreSecurity. I've not found anyway to cast this to allow for me to override this base class in C#. In VB it works just fine.
Ideas?