prg_mirae
❔ Adding Polymorphism to a program
yes that's right. That is Polymorphism But from your earlier message, i guess i got the wrong impression, had thought you're asked to show usage of Abstract, Interfaces, Namespaces , all of these. If you need to have only 4 things for any 1 or 2 of these Poly concepts then that's right, Just use what you've planned with abstract classes.
50 replies
❔ Adding Polymorphism to a program
so yes that's it, besides this one you'll have another namespace that houses presumably other things related to the worms or what they do etc and then you'll at some point have to refer to it so that cross referencing will require you to use that other namespace anyway
50 replies
❔ Adding Polymorphism to a program
yea as long as you have 2 different classes that are responsible for different things say, you could just give them different namespaces and that will make sure the reliance is there and that you'll be showing you know how to refer to it using that other namespace
50 replies
❔ Adding Polymorphism to a program
so you could have for eg something like IAnimal with its concrete class Animal implementing what's been defined in the interface. Something minimal will do since they haven't given you exactly how much to show, right?
50 replies
❔ Adding Polymorphism to a program
Yes, as long as the classes inherit at least a method of the base. So your base class method for eg void PrintMessage -> Console.Writeline("I'm base") then the inheriting classes have their own messages or even do something similar derivedClass' PrintMessage ->Console.Writeline("i'm not base, but i'm derived"); .... know what i'm saying?
50 replies