C# abstract classes and methods in 8 minutes

  Рет қаралды 12,795

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
@dennisdevink5667
@dennisdevink5667 5 күн бұрын
Clear and fast! Thanks 🙏
@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.
@sanjaytharan622
@sanjaytharan622 6 ай бұрын
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.
@WorstDeveloper
@WorstDeveloper 10 ай бұрын
Why would you use abstract classes instead of interfaces?
@iamdev1195
@iamdev1195 7 ай бұрын
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 Ай бұрын
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. 😂
@technocrazy9528
@technocrazy9528 6 ай бұрын
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 Ай бұрын
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.
ASP.NET Localization - Adding a multilanguage content system
14:26
tutorialsEU - C#
Рет қаралды 24 М.
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 19 МЛН
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 13 МЛН
Abstract Reasoning
9:15
Civil Service Review TV
Рет қаралды 19
Master C# Interfaces in 12 Minutes - Beginner Tutorial
11:37
tutorialsEU - C#
Рет қаралды 25 М.
Learn C#: Abstract or Virtual Method, Which Fits Better Here?
7:31
C# Hashsets - Understand them, use them, LOVE them
10:28
tutorialsEU - C#
Рет қаралды 16 М.
Functions vs Classes: When to Use Which and Why?
10:49
ArjanCodes
Рет қаралды 168 М.
#61 Abstract Keyword in Java
12:09
Telusko
Рет қаралды 181 М.
Understand your C# queries! IEnumerable & IQueryable in explained
11:28
tutorialsEU - C#
Рет қаралды 40 М.
Interfaces vs Abstract Classes
14:43
Raw Coding
Рет қаралды 17 М.
C# DELEGATES in 8 minutes! Learn .NET FAST!
8:01
tutorialsEU - C#
Рет қаралды 58 М.