I am confused by C # right now.
I have a bunch of classes, say A, B and C, which all come from the Parent class. I have a function that takes an argument of type Parent, and depending on which child class calls the object with which it is called, I want it to call another method.
I am currently thinking of using dictionary matching types for delegates, but that seems silly, although that’s all I can think of for now.
The problem is that when I am in a function, I only know that it is of type Parent, and I can use GetType to get which one I have that will allow the use of a dictionary. Otherwise, I would probably use function overloading.
Indeed, casting seems like the best method that allows me to use function overloading, which would be much less verbose, but I don’t know how I could do it or if it would work at all.
Any recommendations?
Alexh source
share