Комментарии:
using System;
namespace MyFirstProgram
{
class Program
{
static void Main(string[] args) {
//method overriding = provides a new version of a method inherited from a parent class
// inherited method must be: abstract, virtual, or already overriden
// Used with ToString(), polymorphism
Dog dog = new Dog();
Cat cat = new Cat();
dog.Speak();
cat.Speak();
Console.ReadKey();
}
}
class Animal
{
public virtual void Speak()
{
Console.WriteLine("The animal goes *brrr*");
}
}
class Dog : Animal
{
public override void Speak()
{
Console.WriteLine("The dog goes *woof*");
}
}
class Cat : Animal
{
}
}
thank you
ОтветитьWonderful tutorial, great thanks.
ОтветитьSuper effective !! Thank you !
ОтветитьA random comment down below.
ОтветитьWhat about new Keyword what happens when parent method is virtual and child is new
Ответитьwhat does the fox say?
Ответить🗿🗿🗿🗿🗿 Done!
Ответитьgreat video
ОтветитьSimple and helpful
Ответить❤
Ответить.
Ответитьvery good vid, to the point and very good explanation.
Ответитьyea maaaaaaaaan , super helpful
Ответить❣
ОтветитьThanks bro!
ОтветитьThanks
ОтветитьVery good explanations!
Thanks for sharing.
Thank you! This clarifies my confusion as to when and the difference that a method can be overriden if whether its from a regular class or abstract class.
Ответитьbro,.. great videos, so simple and straight to the point. good review!
Ответитьnice
Ответитьthanks
Ответитьyou are such a bro, bro.
Ответитьvery helpful video. thanks
Ответитьbroooooooooo amazing
Ответить1
ОтветитьBut what does the fox say?
Ответитьso whats the point of overriding? Why not just create a new method that just prints a line?
ОтветитьWow! I've spent more than 15 minutes listening to a video on my C# course about it, I almost fell asleep and absolutely didn't get how method overriding works, BUT 2 minutes of your video and I get it so clear. Thank you very much!
Ответитьgood vid bro
Ответитьlesson check😇
ОтветитьWhy does it still work without putting override and virtual
ОтветитьVRO thanks Short and Effective just perfect
ОтветитьMy compiler says the derived class has to use either override or new? What is new used for in this context?
Ответитьso short and effective!! thank you for not wasting my time!
ОтветитьThanks for the video Bro.
ОтветитьThanks Bro!
ОтветитьThe thumbnails always get me x)
ОтветитьGreat vid bro, you helped me understand c# :D
Ответить