I am new to C#, and are trying to understand classes and "is a" relationships. I've been trying to get a piece of code to work, but I can't seem to get it right.
It looks like this: http://pastebin.com/cQDusptB
I have a base class, Mammal, which one should be able to create instances of, giving the name of the mammal as input. I also have a class, Dog, which is a Mammal. One should be able to create an instance of this too, in the same manner as Mammal.
Can anyone see my flaw(s)? If yes, can you please explain what i misunderstood/forgot?
When posting questions like this it is helpful to also post the error message the compiler gave you.
Can anyone see my flaw(s)?
You have a virtual constructor.
can you please explain what i misunderstood/forgot?
Constructors are not inherited in C# and therefore it makes no sense to mark them as either virtual or override.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With