I have a base class and some classes are inherited from it. I created some overloaded methods that takes those classes as parameters. In a method I only get an instance of the base class whose type is one of its descendant. How can I call it in an easy way? (not creating a Dictionary of inherited classes with values of Type etc.)
private void Method1() { BaseClass inst=new InheritedA(); //cannot change the way it is given DoSthing(inst as ???? ) //I don't know what to insert here: inst as inst.GetType().Name? I really need the instance's class type
}
Probably there is an easy way I just don't get it now :)
Good morning Andris. This forum is for helping customers interoperating with Windows via our open protocol documentation. Your issue does not appear to be related to our protocol documentation. Your question may be better answered by posting on the 'Visual C++ Language' forum at http://social.msdn.microsoft.com/forums/en-US/vclanguage/threads/.
Regards, Bill Wesse Escalation Engineer
Proposed as answer byBill Wesse MSFTFriday, October 17, 2008 9:57 AM
Marked as answer byDavid DoBellTuesday, October 28, 2008 4:02 AM
Good morning Andris. This forum is for helping customers interoperating with Windows via our open protocol documentation. Your issue does not appear to be related to our protocol documentation. Your question may be better answered by posting on the 'Visual C++ Language' forum at http://social.msdn.microsoft.com/forums/en-US/vclanguage/threads/.
Regards, Bill Wesse Escalation Engineer
Proposed as answer byBill Wesse MSFTFriday, October 17, 2008 9:57 AM
Marked as answer byDavid DoBellTuesday, October 28, 2008 4:02 AM
Yes, I know that this forum isn't for that type of question I asked but as I noted in the other duplicate of this message (which ended up in the Sandbox thread), I was unable to set the location of the thread I liked to put this question in (General C# forum) as only 10-12 forums were presented in the listbox (I could put it into Interop, Sandbox, High Capability Systems, Windows Server programming for something, how to create a hybrid car from milk bottles thread etc. :) but the regular forums cannot be found. Can you tell me how could I put it there?Andris