OOP with derived or abstract classes, overrides | IEnumerable [Pt 19] | C# for Beginners

Sdílet
Vložit
  • čas přidán 9. 11. 2023
  • View full playlist: aka.ms/dotnet/beginnervideos/...
    Set up C# in VS Code: aka.ms/dotnet/get-started/vscode
    🏆Earn the C# Certification: aka.ms/csharp-certification
    Let's dive deeper into Object Oriented Programming with our Person/Pet example. We currently have a Person class and a Pet Class. Scott and David build the blueprints to expand our Pet example with base classes, abstract classes, and derived classes.
    Links:
    .NET Beginner Videos: aka.ms/dotnetvideos
    MS Learn: aka.ms/dotnet/beginnervideos/...
    Blog: aka.ms/dotnet/blog
    Twitter: aka.ms/dotnet/twitter
    TikTok: aka.ms/dotnet/tiktok
    Mastodon: aka.ms/dotnet/mastodon
    LinkedIn: aka.ms/dotnet/linkedin
    Facebook: aka.ms/dotnet/facebook
    Docs: learn.microsoft.com/dotnet
    Forums: aka.ms/dotnet/forums
    🙋‍♀️Q&A: aka.ms/dotnet-qa
    👨‍🎓Microsoft Learn: aka.ms/learndotnet
    #dotnet #csharp
  • Věda a technologie

Komentáře • 41

  • @gamagetf
    @gamagetf Před 4 měsíci +23

    This is literally the best instructional video series on programming I have ever encountered. Please, for the love of all that is holy, keep making these videos!

  • @MrMitri22
    @MrMitri22 Před 6 měsíci +11

    Thanks for the positive energy! Had a great time with you mates. Personally, I find your pedagogical approach to be highly effective. I greatly appreciated the balance between the little jokes, the beginner-friendly mindset, and the valuable practical advice. I'm impatient to see you in the next C# modul!

  • @yt_mv
    @yt_mv Před 7 měsíci +12

    please keep on going with more, thanks David and Scott !!!

  • @jaiminparmar7996
    @jaiminparmar7996 Před 7 měsíci +14

    C# has a very elegant syntax 💜

  • @rezz_code
    @rezz_code Před 3 měsíci +2

    among most of the tutorial series in the channel , you guys were the best.
    thanks for the videos.

  • @jamesp1389
    @jamesp1389 Před 5 měsíci +3

    This was great. You both have a gift for breaking things down. Objects and constructors finally make sense to me!

  • @marct8263
    @marct8263 Před 7 měsíci +2

    Coming from a functional language this has really helped me get my head around OOP and how its implemented in c#

  • @HimanshuSharma-wj1jy
    @HimanshuSharma-wj1jy Před 2 měsíci

    Finished all , The way you two taught is awesome I just couldn't stop.
    Thanks and All the best , Looking forward for more videos by you two.

  • @dinindukanchana8554
    @dinindukanchana8554 Před 2 měsíci

    Watched the full series. You are presenting it very well Scott and Fowler. Thank you very much.

  • @WilliamPowerDental
    @WilliamPowerDental Před 7 měsíci +15

    Would be good to lead the learner onto next steps... Further courses or ms learn docs.

  • @WyattHaley-un7wu
    @WyattHaley-un7wu Před 11 dny

    Great series, thanks guys

  • @Melvinn27
    @Melvinn27 Před 5 měsíci

    Great series. Informative and easy to digest. Thanks guys.

  • @xarmanli
    @xarmanli Před 7 měsíci +1

    Great stuff, friends! Keep up the great work.

  • @jarnenrichard7375
    @jarnenrichard7375 Před 6 měsíci

    Thank you guys, learnt new styles/techniques here,, awesome stuff

  • @browsermage
    @browsermage Před 4 měsíci

    Thank you for the playlist 💫💫

  • @whisperscribe
    @whisperscribe Před měsícem

    Wish you guys went all in for all the rest of C# features, really great content

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 Před 2 měsíci

    Thank you for this wonderful intro. :)

  • @vickyRevelli
    @vickyRevelli Před měsícem

    Thank you David and scott

  • @Ricebow11
    @Ricebow11 Před 4 dny

    What would be the NEXT best playlist to watch after finishing "C# for Beginners"? I definitely learned a lot from those two awesome instructors.

  • @drgabi18
    @drgabi18 Před 4 měsíci

    This was a fun series, thanks for the videos!

  • @erhanalankus
    @erhanalankus Před 6 měsíci

    Great series. Thanks!

  • @amjedalsadig2647
    @amjedalsadig2647 Před 2 měsíci

    That was terrific. Thank you for the effort.
    I would really appreciate it if you suggested some follow-up projects to strengthen the knowledge and hopefully, help us learn more

  • @ntsikelelondleleni6335
    @ntsikelelondleleni6335 Před 7 měsíci +1

    I enjoyed this series

  • @Xinmin1000
    @Xinmin1000 Před 5 měsíci +1

    very helpful. please keep going😀

  • @bilkisuismail6096
    @bilkisuismail6096 Před 5 měsíci

    This series is great, i enjoyed it an learnt a lot from it. Please can we get more lessons. Anyone can definitely learn programming from you guys. Thank you

  • @kodjocode
    @kodjocode Před 5 měsíci

    Awesome content

  • @kodindoyannick5328
    @kodindoyannick5328 Před 2 měsíci

    Thank so much.

  • @HugoCostaaa
    @HugoCostaaa Před měsícem

    Amazing

  • @donireland6218
    @donireland6218 Před 4 měsíci

    Very cool explanation. Using your example, how would you deal with pets that don't make noise (lizards, corn snakes etc)? Would those types of pets not have a MakeNoise method? Or would you use some other way of dealing with the question?

    • @Nobiotera
      @Nobiotera Před 2 měsíci +1

      I saw your comment and tried to find an answer. I made it work by putting it like this : public override string MakeNoise() => null;
      I'm kinda late but hope it may help

  • @bilalbyte
    @bilalbyte Před 5 měsíci

    Please upload some more videos on advanced topics

  • @fyu5991
    @fyu5991 Před 4 měsíci

    since we can't create a Pet instance why is the constructor (string firstname) for?

    • @atulkrjha
      @atulkrjha Před 3 měsíci

      According to the inheritance principle. First base class constructor will be called and it will initialize the firstname property to the name passed.

  • @DB42YT
    @DB42YT Před měsícem

    It's "Beyoncé"!

  • @mr_don_key
    @mr_don_key Před 3 měsíci +1

    I think it would be more useful (in terms of learning), to use a concrete (real life) business case to solve. E.g. a real usable to-do list, or a notepad, or a calculator or whichever suitable application.
    All this from A to Z (X-Y-Z being an advanced, with modern writing/refactoring videos). Also show what happens when not using good/best practices. E.g. show the exploit, show what happends in the real application. by doing this, i think people will understand the language better, and concepts behind it too. Instead of vague, non realistic, abstract use cases.

  • @nwngenisys8969
    @nwngenisys8969 Před 4 měsíci +1

    This is too abstract for me... :P

  • @kking999
    @kking999 Před 4 měsíci +1

    what is next ? which lesson we can take further ?

  • @kking999
    @kking999 Před 4 měsíci +1

    the lesson was difficult for me , I don't undertand why they made Pet list in the person class, they should made the dog list or can in person class ?

    • @gower1973
      @gower1973 Před 4 měsíci +3

      If you just created a list of dogs you could only ever add dogs, by creating a list of the base class you can create an object of any derived class in this case Cats or Dogs you cant create an instance called Pet because its abstract

    • @ellisrichards3381
      @ellisrichards3381 Před 2 měsíci

      I hope that helps this vid make sense. The List is a generic Type collection. Meaning if you made a list of Dog then only Dogs could go in the list. But since they made cat and dog derived from the pet class, dogs and cats can both be placed in the same generic list of pets. It’s the beauty of inheritance in OOP.

  • @kvelez
    @kvelez Před 6 měsíci

    var me = new Person("Kevin", "Velez", 19);
    me._pets.Add(new Dog("Bobby"));
    me._pets.Add(new Dog("Toby"));
    me._pets.Add(new Cat("Whiskers"));
    me._pets.ForEach(pet => Console.WriteLine(pet));
    public class Person(string name, string lastname, int age)
    {
    public string _name { get; set; }
    public string _lastname { get; set; }
    public int _age { get; set; }
    public List _pets { get; set; } = new();
    }
    public abstract class Pet(string name)
    {
    public string _name { get; set; }
    public abstract string MakeNoise();
    public override string ToString() => $"{_name} is a {GetType().Name}";
    }
    public class Dog(string name) : Pet(name)
    {
    public override string MakeNoise() => "bark";
    }
    public class Cat(string name) : Pet(name)
    {
    public override string MakeNoise() => "meow";
    }