C# Abstract Classes - What They Are, How to Use Them, and Best Practices

I get asked about abstract classes a lot. What they are, how they work, and why you should know about them. An easy way to think of an abstract class is to say that it fits between a full base class and an interface. Basically, it is a blend of the two. In this video, I am going to demonstrate what an abstract class is, how to use it, and when it makes sense to create an abstract class.
Full courses: www.iamtimcorey.com/
Source Code: leadmagnets.app/?Resource=Abs...
Patreon: / iamtimcorey
Newsletter signup: signup.iamtimcorey.com/
Sponsors:
Tuhafeni Angula (Patreon Subscriber)
0:00 - Intro
0:58 - Demo application walk-through
3:19 - Creating a base Class
5:53 - Making the base class abstract
8:44 - "Interface portion" in the abstract class. The blend of interface and base class
12:56 - Class inheritance in an abstract class
16:00 - When to use an abstract class

Пікірлер: 384

  • @rafaelg0225
    @rafaelg02254 жыл бұрын

    Hi Tim, I've been a lead for the past 12 years for 2 to 80 devs teams with tons of junior and mid level developers and I've never been able to explain in an easy and understandable way abstract classes, you nailed it my friend, from now on everytime a dev ask me to explain abstract classes to them I will send them a link to this video and demand from them to donate 5 bucks to your Patreon ;) Thank you man

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    I am glad it was so clear and thanks for the recommendations.

  • @signon77
    @signon774 жыл бұрын

    For clarity, this chap's tutorials are second to none. He takes a dry subject like 'abstract' classes, breaks it down, gives easy to follow examples and seems to enjoy conveying information to those less experienced than himself. Tim Corey deserves a cyber standing ovation.

  • @signon77

    @signon77

    4 жыл бұрын

    Just to clarify: I have no idea what a 'cyber standing ovation' is as I simply made it up on the spot. An image of grateful theater goers doesn't lend itself to internet usage, true, but I'm sure you get my drift.

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    I appreciate the kind words and the ovation.

  • @marcinpawelw

    @marcinpawelw

    2 жыл бұрын

  • @amortalbeing
    @amortalbeing2 жыл бұрын

    Also for those that might be curious about the difference between a virtual method and an abstract method: Virtual methods have an implementation and provide the derived classes with **the option** of overriding it. while Abstract methods **do not** provide an implementation and **force** the derived classes to override the method.

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    Thanks for sharing.

  • @cirezno5960
    @cirezno59603 жыл бұрын

    Oh my God !! 8 years after school, I for the first time, understand what is an abstract class. And the differences with an interface ! Thank you very much Monsieur Tim Corey

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    I am glad it finally clicked.

  • @TheAngelOfDeath01
    @TheAngelOfDeath012 жыл бұрын

    A short video that absolutely nails it! "A truck is not a car." True... but a truck is a vehicle, and so is a car. So your base class would be vehicle and car and truck would be child classes since they have similar properties. A motorcycle is also a vehicle, as is a tractor. And all of them implement similar properties.

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    Thanks!

  • @louiseolsson794
    @louiseolsson7942 жыл бұрын

    Thank you for always explaining things in a calm and structured way!

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    You are welcome.

  • @marceloleoncaceres6826
    @marceloleoncaceres68269 ай бұрын

    Thank you, Tim. If you find that I thank you more than once for the same video, it's because sometimes I watch the same video a lot of times :) (I wish I could learn only by watching the video once)

  • @IAmTimCorey

    @IAmTimCorey

    9 ай бұрын

    You are welcome. I am glad they are helpful and I am glad you are using them as reference material. That is how I intend for them to be used - they are visual archives of how to do things in C#. Even I refer to them sometimes.

  • @isabelleseah8567
    @isabelleseah8567 Жыл бұрын

    You're honestly the best Tim!! Your videos have helped me grasp the foundational topics so much, and I just love the way you explain concepts in such a clear and concise manner. Thanks loads!!!

  • @IAmTimCorey

    @IAmTimCorey

    Жыл бұрын

    Thank you!

  • @kanteristu
    @kanteristu3 жыл бұрын

    Before this video I thought I understood what an abstract class is and how it works. Now I can certainly say I know way better than I used to. Thank you Tim! Awesome video!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    Glad it was helpful!

  • @EnsYlmaz51
    @EnsYlmaz513 жыл бұрын

    I laughed out loud when auto generated subtitles said "a toilet on Tundra is not a car" at 17:52 great explanation btw, I think I understand all now

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    I work hard on the pronunciation, but once in a while...

  • @anmjubaer
    @anmjubaer Жыл бұрын

    thanks Tim for giving amazing hands-on insights.

  • @IAmTimCorey

    @IAmTimCorey

    Жыл бұрын

    You are welcome.

  • @mantis2k11
    @mantis2k114 жыл бұрын

    Really good explanation for basic approaches. Good to have you here!

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Thank you!

  • @daraiuskeeka8596
    @daraiuskeeka85965 жыл бұрын

    Thank you for making this video. It absolutely helped me remove the fog in my mind and made it easy for me to explain Abstract Classes to my son.

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Excellent!

  • @Shazbot277
    @Shazbot2772 жыл бұрын

    thank you again for a simple explanation of something that seems complex

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    You are welcome.

  • @bernardbouree3997
    @bernardbouree39975 жыл бұрын

    I finally understood the use of abstract class !! Thanks for your great video

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Awesome!

  • @FranciscoPrado-rb4lu
    @FranciscoPrado-rb4lu Жыл бұрын

    WOW! clear and concise the best explanation I have found of abstract classes

  • @IAmTimCorey

    @IAmTimCorey

    Жыл бұрын

    Thank you!

  • @marklord7614
    @marklord76145 жыл бұрын

    I have taken many classes, and I can certainly say that you are very good at teaching. It is a pleasure to learn. I will certainly be purchasing classes.

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    I appreciate the kind words.

  • @Thomas-ix7xq
    @Thomas-ix7xq3 жыл бұрын

    Wow you picked a great example to explain this. Also the explanations themselves are super understandable. In just 20 minutes you explained this way better than my teachers did in multiple lessons. It helped me a lot, thank you!!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    I am glad it was so clear and helpful.

  • @justinfs
    @justinfs5 жыл бұрын

    Thanks for this, I have been reading a book that is heavy on the how and light on the why/when. Your concise explanation helped me to understand the use cases for abstract classes better.

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Excellent!

  • @harag9
    @harag95 жыл бұрын

    Excellent & clear as usual, thanks Tim!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @valeriopavan
    @valeriopavan4 жыл бұрын

    This could represent for me the BIG ANSWER I was looking for! Thanks a lot, Tim! :)

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    You are welcome.

  • @dowdag
    @dowdag5 жыл бұрын

    Excellent insightful video tutorial, thanks!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Great!

  • @torrvic1156
    @torrvic1156 Жыл бұрын

    Great explanations as usual! Thank you Tim!

  • @IAmTimCorey

    @IAmTimCorey

    Жыл бұрын

    You are welcome.

  • @zachallen6256
    @zachallen62564 жыл бұрын

    Man, this is really great. I swear I have had so much trouble figuring out abstracts, delegates, and interfaces but these 3 videos changed that. I will be purchasing the full versions of your lessons and learning c# here from now on. I like to re write the code on my own to make sure I understand what each line is doing, and then trying to create my own examples after it helps it stick.

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Awesome! I'm glad they were so helpful.

  • @jugdeshvaghella4484
    @jugdeshvaghella44845 жыл бұрын

    Thank you alot, I will never forget this.

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @muditha4
    @muditha44 жыл бұрын

    Clear explanation and presentation on abstract classes. I like the way you bring the practical side more into your videos rather than presenting only theoretical aspects.

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Thank you!

  • @codeme8016
    @codeme8016 Жыл бұрын

    Best explanation. Understood finally! Thanks a lot.

  • @IAmTimCorey

    @IAmTimCorey

    Жыл бұрын

    You are welcome!

  • @louisswanepoel1614
    @louisswanepoel16143 жыл бұрын

    This video was sufficient enough in the explanation in the sense that I can have that "Oh yeah," moment while working. Thing is you have so many options to do the same thing and everyone will tell you something different on how to implement a solution. Sometimes you just need to be aware of a useful functionality.

  • @tomthelestaff-iamtimcorey7597

    @tomthelestaff-iamtimcorey7597

    3 жыл бұрын

    Thanks for trusting Tim and watching

  • @jpsietsma
    @jpsietsma5 жыл бұрын

    Your videos are the best, Thanks for all the great content!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @vert3cx373
    @vert3cx3732 жыл бұрын

    Best explanation by miles, thanks Tim!

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    Thanks!

  • @timothyn4699
    @timothyn46993 жыл бұрын

    Very clearly explained, it was fuzzy in my mind before but now I understand what and why you might use abstract items. Thanks!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    Glad it was helpful and clear!

  • @nuno.peixoto
    @nuno.peixoto5 жыл бұрын

    Thanks for your videos! They have been helping me a lot!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Great!

  • @Np10004
    @Np100042 жыл бұрын

    Great Tim. Very clear explanation

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    Glad it was helpful!

  • @nandakun9235
    @nandakun92355 жыл бұрын

    Once you start talking i get this weird awesome vibe that keeps the whole thing intersting to me. You are a wonderful tutor sir, and we are very grateful for what you're doing!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    I'm glad I keep your attention.

  • @oneworldnoborders
    @oneworldnoborders4 жыл бұрын

    Great explanation. Thanks a lot Tim.

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    You are welcome.

  • @xVidarx18
    @xVidarx185 жыл бұрын

    Yet another awesome one!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Thanks!

  • @ragavanraviajan
    @ragavanraviajan5 жыл бұрын

    This video helps to get a quick recap on almost benefits of abstract classes.. Great!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Excellent!

  • @CarlMillsMusic
    @CarlMillsMusic5 жыл бұрын

    Fantastic explanation, thanks so much!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @abdulmudhir4042
    @abdulmudhir40424 жыл бұрын

    I don't know if you still read your comment but man you're a amazing. Thank you very much. Teaching the basic, base, interface cleared up a lot of stuff for abstract classes.

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    You're very welcome!

  • @NotNazuh
    @NotNazuh2 жыл бұрын

    Very clear explanation, thank you.

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    You are welcome.

  • @massimolaruccia1190
    @massimolaruccia11904 жыл бұрын

    Bravo Tim!Sei molto bravo!

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Thank you.

  • @jannieboshoff5185
    @jannieboshoff51854 жыл бұрын

    Writing my 70-483 c# exam soon and your videos definitely helps me prepare much better!

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Great!

  • @moslemkhalili8577
    @moslemkhalili85773 жыл бұрын

    very clear explanation,tanks!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    You are welcome!

  • @superlambda4144
    @superlambda41445 жыл бұрын

    Thank you so much for your video! Your videos are really helpful!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are most welcome. Thanks for watching.

  • @tariqmezeik
    @tariqmezeik4 жыл бұрын

    really amazing job. thanks.

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    You are welcome.

  • @kevkas
    @kevkas5 жыл бұрын

    Great video, very clear explanation, thanks Tim.

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @kevkas

    @kevkas

    5 жыл бұрын

    @@IAmTimCorey Tim, one question if I may from your videos I understand that interfaces can have properties and methods (WITHOUT code in them), and abstract classes can have abstract and virtual methods (WITH or WITHOUT code in them), but not properties. Is that correct? Is that another way to differentiate when to use an abstract class and when to use an interface? Thanks.

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You can have properties in an abstract class.

  • @mahmudx
    @mahmudx3 жыл бұрын

    Tim, Bob Tabor and Kudvenkat are my teaching guru

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    Thank you!

  • @dhanarajsalaimani4642
    @dhanarajsalaimani46423 жыл бұрын

    Great Explanation!

  • @tomthelestaff-iamtimcorey7597

    @tomthelestaff-iamtimcorey7597

    3 жыл бұрын

    Thanks for watching

  • @Kerreber
    @Kerreber3 жыл бұрын

    very clear, thanks!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    You're welcome!

  • @lwinmoehein2894
    @lwinmoehein28943 жыл бұрын

    You explained it well, thanks for your educative video

  • @tomthelestaff-iamtimcorey7597

    @tomthelestaff-iamtimcorey7597

    3 жыл бұрын

    Thanks for investing your time with Tim.

  • @seethablegalzoom
    @seethablegalzoom3 жыл бұрын

    Perfect Explanation!

  • @tomthelestaff-iamtimcorey7597

    @tomthelestaff-iamtimcorey7597

    3 жыл бұрын

    Thanks for watching and sharing your thoughts.

  • @przemol1983
    @przemol19835 жыл бұрын

    Wow. Thank you very much!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @BryanPollardPhotos
    @BryanPollardPhotos3 жыл бұрын

    Another great one!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    Thanks again!

  • @rezaulk
    @rezaulk Жыл бұрын

    Clear explanation , thanks ton

  • @IAmTimCorey

    @IAmTimCorey

    Жыл бұрын

    You are welcome.

  • @tonguyenducmanh
    @tonguyenducmanh Жыл бұрын

    great tutorial. thank u so much

  • @IAmTimCorey

    @IAmTimCorey

    Жыл бұрын

    You are welcome.

  • @alexdonchev1491
    @alexdonchev14914 жыл бұрын

    Good job mate, thanks!!

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    You are welcome.

  • @vinuhosanagar1
    @vinuhosanagar15 жыл бұрын

    You are the best! Thanks much.

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Thanks!

  • @znoran
    @znoran2 жыл бұрын

    Very clear explenation thank you

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    You are welcome.

  • @akshitdas2012
    @akshitdas20123 жыл бұрын

    A really good video.... Thank you so much for this...

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    You are welcome.

  • @vkpunique
    @vkpunique4 жыл бұрын

    Good Video, Covers Everything i want to know about abstract class

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Thank you!

  • @sebastienmorin9020
    @sebastienmorin90203 жыл бұрын

    Great job with the video, you got me out of a serious headache!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    Glad I could help.

  • @sebastienmorin9020

    @sebastienmorin9020

    3 жыл бұрын

    @@IAmTimCorey Your videos are great! Helped me a lot starting my job as a junior!

  • @Uncle-Dee
    @Uncle-Dee23 күн бұрын

    This level of knowledge needs to be made illegal, Wow!! such clarity and finesse! Thank you so much @IAmTimCorey

  • @IAmTimCorey

    @IAmTimCorey

    23 күн бұрын

    I’m glad it was helpful.

  • @JensOleMortensen
    @JensOleMortensen3 жыл бұрын

    Awesome video... Thanks!

  • @tomthelestaff-iamtimcorey7597

    @tomthelestaff-iamtimcorey7597

    3 жыл бұрын

    Thanks for growing your skills with Tim

  • @sanwalchaudhry2099
    @sanwalchaudhry20995 жыл бұрын

    Thanks a lot Corey..

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are most welcome. Thanks for watching.

  • @orany321
    @orany3219 ай бұрын

    Thanks, I know of the use of words "virtual", "abstract" in C#, but it just started to get messy in my head on what's the actual difference between interface and abstract. Now it's clean for me again!

  • @IAmTimCorey

    @IAmTimCorey

    9 ай бұрын

    I am glad it was helpful.

  • @PixelTB
    @PixelTB3 жыл бұрын

    Thank you so much!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    You're welcome!

  • @jellz77
    @jellz773 жыл бұрын

    really great explanations

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    Glad it was helpful!

  • @DanCanning
    @DanCanning7 ай бұрын

    This "IS A" fabulous video. 😃

  • @IAmTimCorey

    @IAmTimCorey

    7 ай бұрын

    Thank you!

  • @Dahgne
    @Dahgne5 жыл бұрын

    Very helpful, thank you

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Great!

  • @anuranjansrivastav9864
    @anuranjansrivastav98645 жыл бұрын

    Very informative..thank you so much..

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @alimusa7058
    @alimusa70583 жыл бұрын

    Thank you Tim you make me understand the benefit and different between abstract and interface and virtual modifier, I studied java but not understand.

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    Glad it was helpful!

  • @bokangkhumalo3354
    @bokangkhumalo33542 жыл бұрын

    🥺😪Thank you so much, this helpled me complete my assignment and i got a distinction 🎊

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    Awesome! Congratulations.

  • @amnesia3490
    @amnesia34904 жыл бұрын

    awesome explanation

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Great!

  • @vaibhavraut6394
    @vaibhavraut63944 жыл бұрын

    This is really good explanation. Whole video is good, later part i liked most. Right we should not use concept because it is there but should be very careful on where it fits perfect specially in case with inheritance as it must maintain Is-a relationship. Thanks Tim!

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Excellent

  • @Bhaweshgupta
    @Bhaweshgupta4 жыл бұрын

    Okay this is some super impressive stuff

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Thank you!

  • @Skeiln
    @Skeiln5 жыл бұрын

    Thank you for your time and effort, this really helps me getting better, I just have a hard time understanding all the different classes and how to use them all together with interfaces, its a hard topic to be honest (or I am just a slow learner that is possible aswell)

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    It is a hard topic. It helps if you start using them (even if you don't fully understand them) in demo projects. As you see how they work, you will get a better grasp on them.

  • @Skeiln

    @Skeiln

    5 жыл бұрын

    @@IAmTimCorey True that, I try to work with them everyday now making small demo's just for fun, it does help me understanding them all better, and I come watch a lot of your tutorials they are really helpful. At this moment I am following a course for C# and we just started with classes and interfaces (& generics). Everyday its going better, its awesome to see myself improve. Thanks again and have a nice day

  • @joeman123964
    @joeman1239644 ай бұрын

    love this! I'm studying for my promotion exams to become a mid level software engineer. i am feeling confident!

  • @IAmTimCorey

    @IAmTimCorey

    4 ай бұрын

    Great!

  • @anhayzzing33
    @anhayzzing334 жыл бұрын

    that was so perfect oh my god you're like the god of I can teach everything to anyone... amen

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    lol, I am glad you enjoyed it.

  • @IdrisQadir
    @IdrisQadir2 жыл бұрын

    Thank you that is great

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    You are welcome.

  • @webster.
    @webster.2 жыл бұрын

    Thanks Tim

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    You are welcome.

  • @Rafacz
    @Rafacz5 жыл бұрын

    Good guy Corey thanks! :)

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @blankomog
    @blankomog2 жыл бұрын

    Hi Tim. Thanks for your great vid as always. Can you do a mini course on Data structures and algos with C#. That will be great!

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/

  • @RalfsBalodis
    @RalfsBalodis3 жыл бұрын

    0:00 - Intro 0:58 - Demo application walk through 3:19 - Creating a base Class 5:53 - Making the base class abstract 8:44 - "Interface portion" in the abstract class. The blend of interface and base class 12:56 - Class inheritance in abstract class 16:00 - When to use abstract class

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    Thanks! I updated the description.

  • @bogidar68
    @bogidar683 жыл бұрын

    Thank you!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    You're welcome!

  • @sang7373
    @sang73735 жыл бұрын

    Thank you so much for taking your time and making all these videos. Appreciate your efforts !!! I would like to know if you are planning to make a video on Reflection ?

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    It is on the list. I've been avoiding it a bit because it is such an abused topic (reflection is rarely the correct answer) but I'll cover it at some point.

  • @miablazekovic1125

    @miablazekovic1125

    5 жыл бұрын

    Glad to hear that, I'm interested too

  • @Nova04550
    @Nova045502 жыл бұрын

    Interfaces and and abstract classes got even more similar in C# 8 since you can now define default implementations of interface members.

  • @IAmTimCorey

    @IAmTimCorey

    2 жыл бұрын

    Yep, there are definitely more similarities, but their purposes have not changed. Don't use an interface in place of an abstract class just because it can have default implementations. That will cause you nothing but pain. Default implementations cannot be used on concrete classes, just with variables that use the interface. Also, they aren't designed to act like abstract classes. They are designed to allow us to upgrade interfaces without breaking legacy code.

  • @gilhooli6685
    @gilhooli66855 жыл бұрын

    I like it. Thanks a lot.

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @RagingTortoise
    @RagingTortoise3 жыл бұрын

    This is such a basic topic, but also a typical interview question!

  • @IAmTimCorey

    @IAmTimCorey

    3 жыл бұрын

    Yep.

  • @samochreno
    @samochreno2 жыл бұрын

    amazing video

  • @tomthelestaff-iamtimcorey7597

    @tomthelestaff-iamtimcorey7597

    2 жыл бұрын

    Thanks for watching

  • @khldomar
    @khldomar Жыл бұрын

    thank you

  • @IAmTimCorey

    @IAmTimCorey

    Жыл бұрын

    You are welcome.

  • @jorgeuribe2847
    @jorgeuribe28475 жыл бұрын

    Hi Tim, please teach us about Aggregation, Composition and association. Great videos btw.

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    I'll add those suggestions to the list. Thanks.

  • @ckschumeister411
    @ckschumeister4115 жыл бұрын

    thank you!

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    You are welcome.

  • @rimmongeorge3587
    @rimmongeorge35875 жыл бұрын

    Great explanation Mr. Tim, thanks, could you cover please the best practices to make commercial applications

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    I am going to cover this in an upcoming series.

  • @abenetbeyene3398
    @abenetbeyene33985 жыл бұрын

    Welcome back Tim..

  • @IAmTimCorey

    @IAmTimCorey

    5 жыл бұрын

    Thanks.

  • @DimiExperience
    @DimiExperience4 жыл бұрын

    Really helpful and awesome for beginners not to struggle, like some of us, later down the road😊! Do you have any “best practices” for designing the sql(or any relational) data structuring? Keep on rocking, C# for life!

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    I have a course that covers the best practices for designing a SQL database: www.iamtimcorey.com/p/sql-databases-from-start-to-finish

  • @kgravikumar
    @kgravikumar4 жыл бұрын

    very nice.

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Thanks!

  • @upcsatx
    @upcsatx4 жыл бұрын

    Good video. Sometimes I find it challenging to figure out when to choose "composition over inheritance". You mention interfaces here, and also how not to treat a car as if it were a truck. Perhaps a future video delving into how/when to choose composition over inheritance. For example, instead of having a car and truck inherit from an abstract vehicle class, just have them both implement the IDriveable interface? ... it's probably one of those situations where there's no right/wrong way, so a video looking at the tradeoffs of doing composition vs inheritance might help. BTW, as I write this I see the Composition Over Inheritance wikipedia page has been flagged as "confusing" since 2015.

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    Thanks for the suggestion. In general, I default to composition because inheritance is really such a small target. However, it does depend on the situation. I agree that it can be very confusing. I'll add the suggestion to my list.

  • @yondaime500
    @yondaime5004 жыл бұрын

    In C# 8, you can now add default implementations to interfaces, which lets you avoid code repetition without using abstract classes. Though it's mostly meant to add methods to an interface without breaking existing classes that implement it.

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    I wouldn't use them in place of abstract classes, though, because they aren't the same thing. Those methods are only available if you use the interface type, not if you use the concrete type or a different interface type. Default implementation does not replace abstract classes.

  • @aqray30
    @aqray304 жыл бұрын

    This a great way to showcases the usage of an abstract class, thanks, Tim! I've worked in different companies and we were using C# as one of the development languages, but I didn't see any usage of an abstract class. My question is: Is it necessary to use abstract classes to achieve the best practice?

  • @IAmTimCorey

    @IAmTimCorey

    4 жыл бұрын

    It depends on the situation.

  • @user-ut2zo1xd6o
    @user-ut2zo1xd6o4 ай бұрын

    Perfect

  • @IAmTimCorey

    @IAmTimCorey

    4 ай бұрын

    Thanks!