Link to home
Start Free TrialLog in
Avatar of Phil5780
Phil5780

asked on

C# Interface parent class

I have a single object which can be derived from 3 separate classes.  This derived object is then passed as a parameter into another class method.  How do I determine which parent class owned my parameter?  

Please refer to the code below:

DriverFord myFord = new DriverFord();
DriverChevy myChevy = new DriverChevy();
DriverHonda myHonda = new DriverHonda();
CarWheel myWheel = new CarWheel();

myWheel = myFord.GetWheel;   //I created a Ford wheel object

SomeClass.SomeMethod(myWheel);  //How do I determine whether that wheel came from a Ford, Chevy, or Honda object?

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of theHollow
theHollow
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Type parameterType = oHandlerResponse.Data.GetType();
Avatar of Phil5780
Phil5780

ASKER

Got it!  By using the Type.Name I was able to nail down who the parent is.  Thanks!