Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
C# method overriding ๐Ÿ™…
Play lesson

C# tutorial for beginners ๐ŸŽต - C# method overriding ๐Ÿ™…

5.0 (6)
48 learners

What you'll learn

This course includes

  • 4 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

C# method overriding tutorial example explained #C# #method #override 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 { } }

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere