C# abstract classes 👻

preview_player
Показать описание
C# abstract classes tutorial example explained

#C# #abstract #classes

using System;

namespace MyFirstProgram
{
class Program
{
static void Main(string[] args)
{
// abstract classes = modifier that indicates missing components or incomplete implementation

Car car = new Car();
Bicycle bicycle = new Bicycle();
Boat boat = new Boat();
//Vehicle vehicle = new Vehicle(); //can't create a vehicle object

Console.ReadKey();
}
}
abstract class Vehicle
{
public int speed = 0;

public void go()
{
Console.WriteLine("This vehicle is moving!");
}
}
class Car : Vehicle
{
public int wheels = 4;
int maxSpeed = 500;
}
class Bicycle : Vehicle
{
public int wheels = 2;
int maxSpeed = 50;
}
class Boat : Vehicle
{
public int wheels = 0;
int maxSpeed = 100;
}
}
Рекомендации по теме
Комментарии
Автор

using System;

namespace MyFirstProgram
{
class Program
{
static void Main(string[] args)
{
// abstract classes = modifier that indicates missing components or incomplete implementation

Car car = new Car();
Bicycle bicycle = new Bicycle();
Boat boat = new Boat();
//Vehicle vehicle = new Vehicle(); //can't create a vehicle object


Console.ReadKey();
}
}
abstract class Vehicle
{
public int speed = 0;

public void go()
{
Console.WriteLine("This vehicle is moving!");
}
}
class Car : Vehicle
{
public int wheels = 4;
int maxSpeed = 500;
}
class Bicycle : Vehicle
{
public int wheels = 2;
int maxSpeed = 50;
}
class Boat : Vehicle
{
public int wheels = 0;
int maxSpeed = 100;
}
}

BroCodez
Автор

I have my first technical interview later this week. Your videos have been the biggest help over anything else I’ve seen on YouTube in getting me prepared. The analogies make plenty of sense and are succinct. Great job!

redbladex
Автор

After 2 years of coding I've finally understand what is the purpose of this "abstract" thanks to you !

faycaled
Автор

Quick and simple, nice refresher/introduction to the concept. Much appreciated.

leonvieira
Автор

This simple explanation is EXACTLY what I was looking for. Thank you.

TXPhoenix
Автор

i struggled with interfaces and abstracts for years. Your videos on this have cleared that up. Thank you;.

lilrex
Автор

2 minutes, perfect explanation!!! I finally get it, I don't understand why other resources don't just say "use it when you don't want it to be possible to instantiate objects from the class" that's so clear and shows me a concrete example of exactly why I would want to use it!

soasertsus
Автор

I bless the universe that you exist in the same lifetime as me. Thank you so much. I was battling with classes and you narrowed it down for me. I hope this applies well to the work I'm about to do. Thank you once more.

pnd
Автор

Brief, short, clear, concise, perfect!

alexandermurciacalderon
Автор

Your videos are perfect. It’s great that you’re sharing the videos in a few minutes

PercentHPGames
Автор

Better explanation than a c# book and ChatGPT. Bravo !

boyar
Автор

Great video!!! This really helped me finally understand what abstract is used for. Thumbs Up!!

BcCivic
Автор

to the point, clear and concise and stuff. I think i'm gonna come here often

Shimzyyy
Автор

Thanks man! Simple and straight to the point! Your explanation actually clicked in my brain!!

alicanted
Автор

you're the best & coolest coder out there !! keep it up man <3
love from bangladesh 🇧🇩

vasykloepexergasia
Автор

Excellent video. Concise and to the point.

jayanders
Автор

An entire university C# class topic simplified in 2.5min. Wow! Unbelievable

victormanuelramirez
Автор

clean and simple in short video. thank you so much.

smbiplob
Автор

You made it so easy to understand that I just came here to comment. Straight to the point videos are so valuable! Already liked the video and subscribed to your channel🎉

fAbbyx
Автор

THIS VIDEO MAKES MORE SENSE than all 30 - 40 mins Videos that i watched on Youtube

nuaymshaikh