0
C# help class
What do I need to use polymorphism in c%? Let me explain, what changes if I create an Animal class and then some classes derived from that base and then create objects belonging to the Animal class using the virtual and override functions, instead of creating multiple classes that don't derive from that base? Suppose I want to apply these two types of syntax while creating a game, what changes? Sorry for my English, i’m Italian.
1 ответ
+ 3
Polymorphism is gonna be most useful when the inheriting classes are *mostly* the same, with minor variations. If you're overriding everything every time, yeah you kinda may as well make two separate classes (or refactor your code). If each child class only overrides one or two things though (especially if they're overriding different things), a polymorphic model is gonna be much easier to manage.