M
muscha
I don't get it. What's the main differences between overriding a base
class's methods vs. hiding them?
Thanks,
/m
class's methods vs. hiding them?
Thanks,
/m
Stefan said:Hi Muscha
overriding = you use all the properties from the base class you just
overrides the mainimplementation.
when you override a function the structure (public override void (int,int))
must be the same.
with new you can use the same method name as a method in the baseclass but
the structure can be different
and you use the properites, variables from the 'normal' class
something completely different to your base method.
muscha said:I see. So in all sense, new and override is completely interchangeably
right?
B obj2 = new D2 ();
D2 obj3 = new D2 ();
obj1.func ();
obj2.func ();
obj3.func ();
The output is:
D1.func () called.
B.func () called.
D2.func () called.
class's methods vs. hiding them?<I don't get it. What's the main differences between overriding a base
Jasper Kent said:If you miss off override, you only get a warning, not an error, and you
get the behaviour as if you had put override (presuming the signatures
match).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.