C# abstract classes and methods in 8 minutes

  Рет қаралды 13,778

tutorialsEU - C#

tutorialsEU - C#

Күн бұрын

Пікірлер: 11
@tutorialsEUC
@tutorialsEUC Жыл бұрын
🚀 C# Progress Academy - Become a job-ready C# and Angular web developer to land your dream developer role: bit.ly/45vbPUg
@Drougar108
@Drougar108 Жыл бұрын
Thank you i had 4 hours of sleep and i needed to get some more abstact and interface info into my brain, and as it is this weeks class subject and im trying to cram it in there.
@dennisdevink5667
@dennisdevink5667 Ай бұрын
Clear and fast! Thanks 🙏
@sanjaytharan622
@sanjaytharan622 8 ай бұрын
This one is a saver!!! Thanks alot❤
@fakeITDevTeam
@fakeITDevTeam Жыл бұрын
Clarly explained. Thank you. Anyway, is this channel still active or do you move to the tutorialseu?
@imranjalali
@imranjalali Жыл бұрын
I think there is no need to define string as nullable object because it is already null by default if no value if given.
@technocrazy9528
@technocrazy9528 7 ай бұрын
At kzbin.info/www/bejne/p5i4Y6KghLB_hpo you say that in an abstract class we can always use virtual so even if Animal is not implementing the IAnimal interface, we can still use virtual on a method to have some default behaviour and the derived classes Dog and Cat do not have to implement MakeSound, they could implement it. But if we want to say that they have to implement it, then we have to make sure Animal implements IAnimal Interface. But with this too, if we have virtual MakeSound method in Animal class with default implementation, the derived classes work even without implementing MakeSound(). Why is this?
@paxer2k
@paxer2k 3 ай бұрын
What do you mean? The whole point of virtual is to provide a default implementation in the parent class (that is abstract) and then inherit it in the child class to provide a different behavior for it. Abstract, on the other hand, just gives you a blueprint for a specific method or property that has no implementation in the parent class, but must have an implementation of the children that implement that class. Virtual does not enforce implementation either. Why? Because there is already default behavior in the parent class and that is sufficient for the compiler. The biggest difference with abstract classes and interfaces is the fact that abstract classes allow you to have base implementation in the parent class, whereas the interface cannot do that. Interface only serves are a plain blueprint which enforces other to implement all of the members of that interface. A good use case for an abstract class might be a class where you want to define generic SQL connection implementation for inserting or fetching generic records, which other classes (e.g. controllers) can make use of and do not constantly need to implement that logic in their own class. In other words, just defining functions that every derived class can use without having to to constantly make their own implementation thereof. So why use interfaces over abstract classes? Well, in C# you can only inherit from 1 class. Therefore, interfaces were created to ensure that classes can implement indefinite interfaces. If you look at languages like C++ and Python, they do not contain interfaces. Why? Because they allow for multiple inheritance, where you can just inherit as many times as you want. Why did C# do it like this? I have no idea. Most likely because this language is derived from Java, which also does not have support for multiple inheritance. Finally, come back to your question once again... Given that Animal class has default virtual implementation, why do the derived classes work without having the MakeSound() method? Well, because the parent class (Animal) already has an implementation for that class which does not enfornce the children classes to implement it. If you want this to be enfornced, just use the abstract key word in your abstract class.
@WorstDeveloper
@WorstDeveloper Жыл бұрын
Why would you use abstract classes instead of interfaces?
@iamdev1195
@iamdev1195 8 ай бұрын
for direct usage : for eg - Math m = new Math (); var r = m.round(3.12); // this does not make sense that is why we directly use the function like - abstraction Math.Round(3.12);
@MrBestard
@MrBestard 3 ай бұрын
Most of the examples on the internet don't explain it in the right way. That's why people always ask this question again and again. 😂
ASP.NET Localization - Adding a multilanguage content system
14:26
tutorialsEU - C#
Рет қаралды 25 М.
Master C# Interfaces in 12 Minutes - Beginner Tutorial
11:37
tutorialsEU - C#
Рет қаралды 28 М.
SLIDE #shortssprintbrasil
0:31
Natan por Aí
Рет қаралды 49 МЛН
I'VE MADE A CUTE FLYING LOLLIPOP FOR MY KID #SHORTS
0:48
A Plus School
Рет қаралды 20 МЛН
Every team from the Bracket Buster! Who ya got? 😏
0:53
FailArmy Shorts
Рет қаралды 13 МЛН
Learn C#: Abstract or Virtual Method, Which Fits Better Here?
7:31
Abstract Classes and Methods in Java Explained in 7 Minutes
7:00
Coding with John
Рет қаралды 576 М.
C# Hashsets - Understand them, use them, LOVE them
10:28
tutorialsEU - C#
Рет қаралды 17 М.
C# Extension Methods Tutorial - Extend your C# Knowledge
6:18
tutorialsEU - C#
Рет қаралды 10 М.
Using JSON IN C#! Serialization & Deserialization made easy!
14:47
tutorialsEU - C#
Рет қаралды 38 М.
Understand your C# queries! IEnumerable & IQueryable in explained
11:28
tutorialsEU - C#
Рет қаралды 42 М.
C# Yield - Creating Iterators for beginners
5:52
tutorialsEU - C#
Рет қаралды 12 М.
Fundamental Concepts of Object Oriented Programming
9:16
Computer Science Lessons
Рет қаралды 992 М.
SLIDE #shortssprintbrasil
0:31
Natan por Aí
Рет қаралды 49 МЛН