On Jun 29, 5:21 pm, Bob Jones <goodold...@gmail.com> wrote:
> Ok, I am curious if this can be done in C# 2.0 via some internal .net
> functionality or if I have to do a coversion myself such as a copy
> construtor or override the explicit operator.
>
> I have 3 classes.
>
> ClassA
> ClassB which derives from ClassA
> ClassC which derives from ClassA as well
>
> I can implicitly convert to ClassA from ClassB and ClassC. Easy
> enough
>
> I would like to convert ClassB to ClassA and then create a new
> instance of ClassC and use the converted ClassA to fill in the
> derived
> methods and properties in ClassC without having to write code that
> literally copies values from one class to the other. Is this
> possible?
>
> Psuedo Code:
>
> ClassB classb = new ClassB();
> ClassC classc = (ClassC)(ClassA)classb; //this doesn't work but you
> get the point.
>
> Thanks!!
|