prg_mirae
prg_mirae
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ 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
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
well, sounds like you know what you're doing to be honest! 🙂
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ 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
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ 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
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
do it do it!! 😄
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
yep, absolutely!
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
hehe yea that's a start right 🙂
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
so as a start, find a method that does quite a bit ... see if that one can be defined in an Interface?
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
thing is.. you might feel it's a lot of work to refactor it.. but then you just have to be patient and zoom in on all that code and see if you can try to pull bits out part by part
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
lol! so then they decided to then throw all the specifics at you after you've completed it ! hhehhe
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ 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
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
thing is your Abstract class CAN inherit from an Interface if that's what you want to do, ya know, chain them all together... but that sorta defeats the purpose of OOP concepts you see
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
well if that's what's they want you have no choice ? 🙂
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
they have to be inherited
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
Interface has only the signatures
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
well abstract class can have both abstract methods and non-abstract methods.
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ Adding Polymorphism to a program
yes it can
50 replies
CC#
Created by Jack Badassson on 5/4/2023 in #help
❔ 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