Abstract Class vs Interface (Real Application Use) in C# .NET
Вставка
- Опубліковано 6 бер 2023
- Q. What is the difference between an Abstract class and an Interface (atleast 4)?
Q. When to use Interface and when Abstract class in real applications?
1. Full .NET Interview Course (with PDF Book)
C# / ASP.NET Core / MVC / API - Top 500 Interview Questions
www.udemy.com/course/csharp-o...
Don't worry if course not helping you, Udemy has 30 days Free Refund Policy.
2. Quick Revision Book (PDF format)
Top 500 .NET Interview Questions - OOPS/ C#/ ASP.Net/ MVC/ SQL /.Net Core /Web API
imojo.in/interviewhappy
50% Discount Applied on above link.
Don't worry if book not helping you, I will return 100% of your money with in 7 days of purchase. Just mail me at anuragrawat123@gmail.com.
My best wishes are with you.
This is the one abstract class video that actually makes sense to me thank you
months of confusion minutes of solution... thanku
its very lucid
welcome Zeenat. All the best for your career.
Excellent 👌
After watching lots of difference, now I get clear idea 💡 about it...
Thank you 👍
Super anna... excellent keep going do all videos anna we will support you
thank you for excellent content - exactly what people needed here
Abstract class :
It is declared as abstract keyword.
It has both abstract and not abstract method.
It has both declaration and definition.
Default scope of member is private.
Multiple inherence is not supported.
It can have constructor
Interface:
It is declared as interface keyword.
It has only abstract method.
It has only declaration.
Default scope of member is public
It supports Multiple inherence.
It does not have constructor.
very nice explanation, Thanks to you !!
"Thank you for the video and all your hard work! I noticed at 6:01 you said, 'Normally we prefer Interfaces because it gives us the flexibility to modify the behavior at a later stage.' I think you might have meant to say abstract classes. Although interfaces can be changed later, there's a problem because every time you add a new method to the interface, all the classes that use this interface have to be updated to include this new method. That can cause a lot of extra work.
I have no word for your knowledge, awesome happy rawat ji
Thanks a lot Naveen
Exactly what for I was looking 👍 thanks
Great video! Thank you for the splendid explanation!
Glad it was helpful! @super
Awesome stuff
Sir First point clear nhi huva.. Ki new feature m hum method body interface and abstract class m use kar sakte h.. Phir ye man ley ki new feature k ane pr first difference jo aap ne btya h vo exclude hai?
Use of inheritance is reuse code but when we use interface for multiple inheritance we need to write method body in each derived class. Pls clarify my doubt
Sir please video in hindi on why we need to create abstract class TCS interview question.
Hello and Thank you for this tutorial.
I think methods in interface can not have accessors, like public, etc.
Why have you hidden 19 videos?
4 year full stack .net developer ko kitna package hona chahiye
amazing bro keep rocking
Thanks @grijan
but the interface now can have constructor
Thankyou so much
Thank you for clear my query
Always welcome
exactly what people look for 👍🏼
Thanks Armaan. May your achiever all your career "armans".
Thank you so much 🙏🏽🙏🏽🎉🎉
You are so welcome my friend @niteshgupta5901
Abstract class can contain class fields but interface cannot contain class fields
very good
Thanks Gaurav and all the best for your career
if abstract class contain constructor but abstract class can not be initiated. then use this constructor?
derived class instantiation calls it first before calling derived's own constructor. Opposite sequence for destructor.
Thank you
You're welcome
But in your example you use public access modifier in interfaces. I think we cannot use public access modifiers in interfaces.
yes you can like this, public interface IExampleInterface
Thank you for your video, I found it very clear in explanation, but without wishing to be rude, your pronunciation of “methods” sounds like “matters” and I had to turn on captions to understand what you were saying 🤷♂️
@Cormac, well noted, will try to be more clear with the sound :)