Beginning C# - Part 25: Overriding | Ray Wenderlich

In this video, you'll learn what it means to override methods and how to override methods in your child classes.

This is a companion discussion topic for the original entry at
1 Like

Hi Brian! I would like to ask, is this lesson the last one or there will be new someday?
Thanks for you work, it help me a lot to understand some language concepts.
Looking forward to watch new series!

Hey There … I was about five or six left to go. They’ve been moving slower lately due to the upcoming RWDevCon and I’ve been pinched for time, but I’ll be finishing it out soon. I’m glad it helped you out!


So it’s quite likely that I’ve made a mistake, but this code (at about 7:00 to 7:30) doesn’t seem to actually work:

if (damageType == damageType.Fire)
base.TakeDamage(amount*10, damageType.Water);

It seems to say that if the damage type is Fire, then the enemy takes 10x the damage and the damage type passed into the base function is Water.
And when I tested it in OnDisable, it didn’t work as intended.

I used this code instead:
if (damageType == damageType.Fire)
base.TakeDamage(0, damageType.Fire);
else if (damageType == damageType.Water)
base.TakeDamage(amount * 10, damageType.Water);

@bdmoakley Can you please help with this when you get a chance? Thank you - much appreciated! :]

Can you clarify what mean when you say it doesn’t work? Is it producing an error, are you getting a different value? Or, is nothing happening? What are you experiencing?