Advanced Inheritance & Polymorphism - example with Array of Objects (in-depth Data Structures & OOP)

Поделиться
HTML-код
  • Опубликовано: 25 июн 2024
  • This video provides an in-depth explanation of the relationship between Arrays of objects and OOP concepts such as Inheritance and Polymorphism. It is a programming tutorial designed to teach you about data structures, object-oriented programming, and best practices for writing code. Through a practical example, you will learn how to create arrays that hold a collection of different objects. By the end of this coding exercise, you will have a solid understanding of how to implement parent-child relationships between classes and write reusable code. Additionally, you will learn how to implement polymorphic behavior and write efficient code.
    To put your knowledge into practice, I have also prepared a practical task for you. This hands-on challenge will ensure that you understand these concepts and are able to use them in your own programming projects.
    📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
    C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
    Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
    🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
    Experience the power of practical learning, gain career-ready skills, and start building real applications!
    This is a step-by-step course designed to take you from beginner to expert in no time!
    💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
    Use it quickly, because it will be available for a limited time.
    ☕ If you've found my content helpful and would like to support me, you now have the option to buy me a coffee or a cookie! It's a small gesture of gratitude that means a lot to me and helps me keep creating free educational videos for you. Use the link to make a contribution: bit.ly/CodeBeauty_BuyMeACoffee
    However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇
    Related videos:
    Array Data Structure (for absolute beginners) - • DATA STRUCTURES - How ...
    Array of Objects Introduction - • Arrays of objects - In...
    Dynamic Array of Objects - • Dynamic Arrays of Obje...
    Classes and Objects for Beginners - • C++ OOP - Introduction...
    Inheritance for beginners - • C++ OOP - What is inhe...
    Virtual functions, pure virtual functions, and abstract classes - • Relationship between V...
    Polymorphism for beginners - • C++ OOP - What is poly...
    CONTENTS:
    00:00 - What you will learn in this video?
    02:06 - Explaining initial code
    03:33 - What is Inheritance?
    03:52 - Inheritance implementation
    06:48 - What are virtual methods and abstract classes?
    09:37 - What is polymorphism?
    10:39 - Polymorphism implementation
    15:23 - Memory deallocation
    16:26 - How to deallocate memory?
    17:48 - Static code analyzer
    18:35 - Practical task for you
    21:18 - Bloopers
    🎁 Download PVS-Studio for free & analyze your code: bit.ly/PVS-StudioFreeCB1
    Add me on:
    Instagram 📸 - / truecodebeauty
    Twitter 🐦- / truecodebeauty
    ******CODE IS IN THE COMMENTS******
  • НаукаНаука

Комментарии • 48

  • @CodeBeauty
    @CodeBeauty  10 месяцев назад +18

    📚 Learn programming with these Free E-Books ⬇
    C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
    Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
    🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
    Experience the power of practical learning, gain career-ready skills, and start building real applications!
    This is a step-by-step course designed to take you from beginner to expert in no time!
    💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
    Use it quickly, because it will be available for a limited time.
    Code:
    #include
    #include
    using namespace std;
    class Student {
    public:
    string Name;
    int Age;
    char Gender;
    virtual void study() = 0;// a pure virtual method
    };
    class ProgrammingStudent : public Student {
    void study() {
    cout

    • @SenioritaAlaa
      @SenioritaAlaa 9 месяцев назад

      i have question here,
      how can i use destructor to deleted those objects here??

  • @dundyd3612
    @dundyd3612 10 месяцев назад +15

    You're an excellent teacher, and have a great gift to explain these complex topics so well. I admire you even more now that I know English is not your native language!

  • @amelccc
    @amelccc 10 месяцев назад +15

    standing ovation for this video, your effort in simplifying these concepts deserves a big round of applause

  • @deanmorrison6254
    @deanmorrison6254 10 месяцев назад +11

    just wanted to drop a quick shoutout for your video, your teaching style rocks, many thanks

  • @codeoasis1180
    @codeoasis1180 10 месяцев назад +14

    your breakdown of arrays of objects, along with insights into polymorphism and inheritance, has given me a solid grasp on these topics, thank you Saldina

  • @user-lu6kv9kr8u
    @user-lu6kv9kr8u 10 месяцев назад +14

    hey there Saldina, your video seriously helped me wrap my head around complex programming topics such as this one, just wanted to say thank you

  • @user-sw8bq1rk9c
    @user-sw8bq1rk9c 10 месяцев назад +14

    can't thank you enough for this video, you are truly empowering me on my coding journey. Fantastic instructor

  • @dexianchen7778
    @dexianchen7778 10 месяцев назад +14

    Thank you for the excellent content!

  • @anwar6971
    @anwar6971 10 месяцев назад +5

    Thanks, watching all these series of videos related to array of objects

  • @lamienali8467
    @lamienali8467 10 месяцев назад +6

    Thank you for this insightful lesson your coding videos are incredibly valuable for learners like me.

  • @milkamilkica1935
    @milkamilkica1935 10 месяцев назад +5

    excelent explanation as always, thank you Saldina

  • @christopherrice891
    @christopherrice891 10 месяцев назад +14

    I thought English was Saldina's native language. What IS her native language then🤔?

    • @purveshsane1435
      @purveshsane1435 10 месяцев назад +2

      Bosnian I think. I’ve noticed that younger people in ex Yugoslav countries tend to speak English pretty well though. But obviously it will be noticeable to native speakers (like myself) that it’s not their first language.

  • @l.p.1967
    @l.p.1967 10 месяцев назад +2

    i wish there is more instructors like you, thanks

  • @hilgicamala2520
    @hilgicamala2520 10 месяцев назад +3

    great content Saldina, superb explanation, thx

  • @pedrolobo9835
    @pedrolobo9835 10 месяцев назад +5

    Hi, can you please make a video about Lybiscovist Substitution Principle? This is deeply related to this topic.

  • @OzzFan1000
    @OzzFan1000 10 месяцев назад +2

    Excellent explanation on inheritance and polymorphism! Thank you so much.

  • @harrisonzuletamontoya4615
    @harrisonzuletamontoya4615 5 месяцев назад

    seriously thanks for the videos and all what you've done, I'm studying with all the lists of c++, I have learned all what a I know from you, thank you

  • @lamienali8467
    @lamienali8467 10 месяцев назад +5

    Could you possibly delve into the use of different scripting languages like Python and C++ to create a login page?

  • @580HexShank
    @580HexShank 9 месяцев назад

    Your videos are filled with highly inspirational and generous instructions. Thank You Saldina Thank You. You’re by far the best most legendary C++ instructor I’ve ever met over the internet. Be well Saldina. Peace and Blessings through our Blessed Mother.

  • @nv9usb381
    @nv9usb381 10 месяцев назад +2

    just what i needed, thank you Saldina

  • @salihbarknakkaya8101
    @salihbarknakkaya8101 2 месяца назад

    Well it is done. I watched all of the oop lessons here. It was totally a masterpiece. I will do more practice and in a few days I will start data structures playlist in your channel. (maybe pointers as well) Thanks for the all cool informations, It was the best so far I have ever seen, u r great!

  • @johnmichaelisaac7365
    @johnmichaelisaac7365 9 месяцев назад

    I didn't know I could do arrays of pointers for every object I make. This is super helpful thank you so much, learned a lot just from this vid🎉

  • @diegopereira524
    @diegopereira524 10 месяцев назад +4

    Hola Saldina también se puede considerar usar un poco el standard de C++ algo asi std::vector combinado con las interfase separadas de la clase Student del ejemplo.
    Ver:
    #include
    #include
    #include
    using namespace std;
    /// Part of library study() ///
    class IStudy {
    public:
    virtual void study() = 0;
    };
    void print( vector &vecStudent ){
    for( auto &student : vecStudent){
    student->study();
    }
    }
    /// Fin library ///
    class Student{
    public:
    string Name;
    int Age;
    char Gender;
    Student() : Name{}, Age{0}, Gender{' '}{
    cout

  • @gollygobih6527
    @gollygobih6527 10 месяцев назад +1

    superb content, even better explanation

  • @PinkyPowers
    @PinkyPowers 6 месяцев назад +2

    This challenge was awesome fun!
    Mine is broken up into 8 different files (prototype header and body cpp files for each class), but here is how the main() looks, and what prints out in console:
    #include
    #include "monster.h"
    #include "dragon.h"
    #include "werewolf.h"
    #include "zombie.h"
    int main(){
    Monster* monsters[3];
    monsters[0] = new Dragon("Smaug", "Reddish Gold", 50);
    monsters[1] = new Werewolf("Fenrir", "Ash Grey", 10);
    monsters[2] = new Zombie("Dwight", "Pale", 6);
    for (int i = 0; i < 3; i++){
    std::coutprintMonster();
    monsters[i]->move();
    monsters[i]->intimidate();
    monsters[i]->attack();
    std::cout

    • @CodeBeauty
      @CodeBeauty  6 месяцев назад +1

      🚀✨️✨️

  • @logingame5877
    @logingame5877 9 месяцев назад

    I love ur teaching! When does your Programming course exactly start?

  • @banglarif
    @banglarif 8 месяцев назад

    Waiting for your course to make C++ as my native language. I can understand it takes time to make a best course. But still very hungry for that..... :)

  • @mamun3192
    @mamun3192 10 месяцев назад

    please cover full STL of C++ and policy based Data Structure also ( using STL)

  • @dwivedys
    @dwivedys Месяц назад

    After we have deleted the dynamic memory taken up by the three objects - don’t we also need to delete the array students of pointers to the objects?

  • @chupacabra1899
    @chupacabra1899 7 месяцев назад

    hey saldina can you talk about class composition vs class inheritance??

  • @ertemeren
    @ertemeren 7 месяцев назад

    Hi Saldina. Do you have a separete video about composition?

  • @AshaRASHA-sv7nq
    @AshaRASHA-sv7nq 10 месяцев назад +1

    Hello saldina, could you please explain opengl and STL in c++ , BTW i just love your teaching skills its Brillant 😍

  • @srikanthreddy9330
    @srikanthreddy9330 4 месяца назад

    @CodeBeauty
    Need the videos of the c++ in a sequential manner which include indepth concept and also the 10hr course of entire c++ is not including every concept you explained.
    Please provide the sequence of each and every indepth concepts of c++>

  • @ATAG-yn5pd
    @ATAG-yn5pd 9 дней назад

    Don't we need a virtual destructor in the base class?

  • @chupacabra1899
    @chupacabra1899 7 месяцев назад

    hey saldina at the end of your video you didn't say student[i] = nullptr; i think in a video of yours you said it was a good practice

  • @JeffRyman69
    @JeffRyman69 10 месяцев назад

    Sometime I would like to see you comment on why you like object-oriented programming. I have seen several videos critical of OOP but I don't have the experience to intelligently comment on their viewpoint. I am a retired research engineer with programming experience in imperative programming using machine and assembly language on early computers, and later with FORTRAN, some C, and a touch of BASIC. I had a single class in C++ over 20 years ago but changed jobs to a non-programming environment so I never got a chance to use it. I will note that modern Fortran standards have now incorporated some OOP capabilities, so I am interested in seeing if those capabilities might be useful.

  • @santhrupthik2287
    @santhrupthik2287 4 месяца назад

    which coding language is used throughout your practical programming course???

  • @thrice5560
    @thrice5560 10 месяцев назад +5

    hi

  • @kateranks9755
    @kateranks9755 10 месяцев назад

    Please could you teach me how to build a webbrowser with tabs in it

  • @hassanalmasri3935
    @hassanalmasri3935 10 месяцев назад

    Please ma'am, i need help
    I want to learn OpenGL and i need to link the glfw and glut libraries in order to continue but i am using vsCode and i tried lot's of things on the internet but nth worked.
    Please can you help me ?

  • @locngothis
    @locngothis 13 дней назад +1

    new => wheww

  • @andriy_bondarenko
    @andriy_bondarenko 10 месяцев назад

    // This is my funny program to study abstract classes
    #include
    #include
    using std::cout;
    const int tempo = 500;
    const int camerton = 220;
    void Performance(int notes, float* pitch, int* duration)
    {
    for (int i = 0; i < notes; i++)
    Beep((camerton * pow(2, pitch[i] / 12)), duration[i] * tempo);
    }
    class Instrument
    {
    protected:
    int notes;
    float* pitch;
    int* duration;
    public:
    virtual void Play() = 0;
    };
    class Piano : public Instrument
    {
    public:
    Piano()
    {
    notes = 7;
    duration = new int[notes] { 1, 1, 1, 1, 1, 1, 2 };
    pitch = new float[notes] { 5, 5, 12, 12, 14, 14, 12 };
    }
    void Play() override
    {
    cout