Practical Polymorphism C++

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ย. 2024

ความคิดเห็น • 236

  • @martinofeldman1039
    @martinofeldman1039 5 ปีที่แล้ว +237

    You are a very clever guy. And I realized that my brain needs some upgrade...

    • @javidx9
      @javidx9  5 ปีที่แล้ว +90

      lol thanks Martino :D Download some more brain!

    • @sweetberries4611
      @sweetberries4611 5 ปีที่แล้ว +22

      @@javidx9 Like, download more ram?

    • @yassine321
      @yassine321 5 ปีที่แล้ว +5

      U should see the appropriat requirements system for ur old end brain

    • @theternal
      @theternal 5 ปีที่แล้ว +6

      @@javidx9 plz link

    • @ananttiwari1337
      @ananttiwari1337 3 ปีที่แล้ว +2

      Well, idk about downloading free brain but you can try www.downloadmoreram.com to download more free RAM!! totally works 100% legit free definitely not a rickroll*

  • @willmapleson1023
    @willmapleson1023 3 ปีที่แล้ว +27

    Your optimistic attitude and thorough explanations make learning new things such a breeze. You are a great teacher. If you ever made a paid C++ beginner to expert course, I would pay big $$$.

  • @leerv.
    @leerv. 4 ปีที่แล้ว +14

    Polymorphism literally means "many shape"-ism, so this seems like the perfect implementation of an example. :)

  • @BinkiklouGaminglol
    @BinkiklouGaminglol 5 ปีที่แล้ว +41

    You are very smart, placing the camera infront of the mirror is genius.

    • @kushagra64
      @kushagra64 4 ปีที่แล้ว +2

      I really didn't realized that :0

  • @KingdomBusiness21
    @KingdomBusiness21 5 ปีที่แล้ว +14

    The amount of appreciation I feel for you and the knowledge that you have broken down in the first 10 minutes of this video is truly unquantifiable. I am blessed to live in a time where I can seek to learn a topic and stumble upon this informaiton on demand and free. I hope that what I received for me is returned to you ten fold! You are very helpful and kind. Thank you.

    • @javidx9
      @javidx9  5 ปีที่แล้ว +4

      Incredibly kind words Kirk, much appreciated and im pleased you found it useful.

  • @EmmanuelMayor
    @EmmanuelMayor 3 ปีที่แล้ว +10

    Man, of all the programmers I've been seeing on TH-cam, I think you are one of a kind. I'm' finally understanding a lot of things about OOP just by watching your videos. Never thought that OneNote could have another use other than bloat Windows 10, in fact, those are the parts I love the most. Thank you.

  • @KiAb0n0V
    @KiAb0n0V 5 ปีที่แล้ว +14

    @Javidx9 I'd like to thank you for your videos, the way you explain computer science concepts helps me to fill up all the missing knowledge from uni.

  • @orfeasliossatos
    @orfeasliossatos 5 ปีที่แล้ว +2

    The little pause when you cut to real life brings me endless joy, also this is exactly what I was looking for!
    I’m creating a program through which I can run other little programs, but since they all have the same structure (Input-Update-Display) I learned I could have been using polymorphism to create a « subProgram » class and clean up my code.
    Thank you, have a wonderful day!

  • @DeepFriedOreoOffline
    @DeepFriedOreoOffline 2 หลายเดือนก่อน

    In an ecosystem where people generally hate object oriented programming because they've had bad experiences making structures before they know what they need, it's nice to see good videos explaining how to do it better!

  •  5 ปีที่แล้ว +12

    Another great video, Thanks :)
    a small issue: the zoom in and out factors are not reciprocals (1.1 and 0.9). So, once you zoom in you will not return to the same screen by unzooming. Of course, it’s not critical for a tutorial :)

  • @arcnaver
    @arcnaver 5 ปีที่แล้ว +3

    This is a heck of a lot better of an explanation than my University class material! You need to do more stuff like this! Thanks.

  • @SaifUlIslam-db1nu
    @SaifUlIslam-db1nu 5 ปีที่แล้ว +1

    My friends around me talk all the time about how to implement graphics onto the console ( we use Dev C++ ), how to develop actual practical applications instead of small management systems; and that's what most of us actually do, prepare small hotel/bank/transportation management systems and just say this is our semester's project.
    But you have made implementing and working with graphics quite intuitive, I understand a lot of why some things are happening, and I can explain why they are happening. This series that you have offered us students has helped me to greatly improve my logic, far above websites like Hacker Rank ( ask any freshmen in my Uni about where to go to improve your problem-solving skills, they say Hacker Rank :/ ). I have learned quite a lot from you, and I can confidently say that if I had sat down to think of the magnitude of the problems which you have dealt with, it would take me some weeks to actually write some something small and applicable. I'm not even confident after watching some of your videos if I can make my things by just looking at your code, though I expect that I should be in the future.
    This is how programming should be taught, dealing with tough problems by breaking them into small pieces.
    Thank you so much. When I get a job, I'll be sure to contribute to you! :)

    • @javidx9
      @javidx9  5 ปีที่แล้ว +1

      Hi Saif, such kind words, and much appreciated words. I'm very pleased you are finding the videos helpful. Thank you, and good luck with your studies!

  • @Janokins
    @Janokins 5 ปีที่แล้ว +2

    That bit about the classes becoming abstract because of the pure virtual functions - and the fact that they can't be made into objects, has really clarified a lot for me. Thanks

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Good stuff Matthew, this is a really high level look at OOP potential, so Im pleased its helping out!

  • @skilz8098
    @skilz8098 4 ปีที่แล้ว +1

    Very intuitive! A possible nice feature you could add to this application in regards to the spline or the curve would be the ability to add additional nodes or points after it is drawn. So if the user selects the curve between the 2 endpoints (the beginning and endpoints) the application would then get the point defined by the mouse's position and add that as a new node at that location on the curve. It would then use the previous and next nodes as the two endpoints to generate a new curve on the existing curve. Another rich feature would be able to create an arbitrary polygon from multiple lines. When creating multiple lines, if two points coincide you could allow the user to have the option to combine those multiple points into a single point. The arbitrary polygon would not be created unless if it is entirely enclosed, otherwise, you would just have a list of lines with connected vertices.

  • @ValeriCFBG
    @ValeriCFBG 3 ปีที่แล้ว

    One thing that I learned from watching those is that it may feel intimidating to understand the math in the speed of the video, but when you actually sit down and think about those (takes me 1-2 hours) you start going "Ohhhhh....that makes sense!"
    Keep it up, amazing stuff!

  • @delofon
    @delofon 4 ปีที่แล้ว +1

    I think I now understand inheritance and polymorphism, at least, a bit better (finally). Ty for educating us all!

  • @onogrirwin
    @onogrirwin 2 ปีที่แล้ว

    shoutout to that snazzy telephone on the nightstand. To it, C is a brand new high level language.

  • @janousekpetr6843
    @janousekpetr6843 ปีที่แล้ว

    Great video, I absolutely loved it! However, if anyone else is getting SEGMENTATION FAULT ERROR, notice that at 27:35 line 98-100, javidx9 mentions you need to assign *selectedNode to nullptr => but also assigns nullptr to *line. I believe it's not mentioned but it is visible at 29:58.

  • @leonardochiruzzi7642
    @leonardochiruzzi7642 5 ปีที่แล้ว +3

    This is just what I was looking for. I've banged my head for years. A million thanks!

    • @javidx9
      @javidx9  5 ปีที่แล้ว +1

      I hope you find it useful Leonardo, its not the easiest topic to deliver via video :D

  • @rfdave3980
    @rfdave3980 3 ปีที่แล้ว

    You have explained the concept very well, Dave. It is a difficult thing to get your head around. Thank you !

  • @racorescript
    @racorescript 5 ปีที่แล้ว

    OOB is like wine: enjoy with moderation, which is exactly what you did so, yet again, please accept my compliments.
    Those are by far, in my opinion, the best videos about programming i saw on TH-cam. Since you have an established audience of people who wants to learn some serious programming, you may consider to extend this topic talking about templates at some point. After all, why do something at run time when it can be done at compile time, right?
    Keep up the great work. Looking forward for the next episode of the top down city games. Bye

  • @abhishekgy38
    @abhishekgy38 5 ปีที่แล้ว +1

    @javidx9 This is top notch, sir. I'm happy I came across your channel.Looking forward to more of these.

  • @revealingfacts4all
    @revealingfacts4all 5 ปีที่แล้ว +2

    virtual public functions goes against advise of other professionals because it encourages one to redefine the public API, i.e. change the contract, through overloading where the idea is you simply want the same API or contract but with different functionality. You can pull this off by keeping the public functions non virtual and having them call virtual private methods like you describe in this video. This is called the NVI (Non Virtual Interface) pattern. See Scott Meyer's non virtual interface pattern or Herb Sutters article called "virtuality." Otherwise, great video and material!

  • @NeilRoy
    @NeilRoy 5 ปีที่แล้ว +49

    Very nice explanation. I'm still more of a straight C man though.

    • @tomershechner
      @tomershechner 4 ปีที่แล้ว +29

      I'm a gay C man

    • @GabrielPiveta
      @GabrielPiveta 4 ปีที่แล้ว +2

      haha i see your comments all over the internet

  • @YoomarTuNoOmar
    @YoomarTuNoOmar 5 ปีที่แล้ว

    Thank you very much programming wizard, this is exactly what I needed. I am planning to do a WindowsForm-Like application for some school project using olcConsoleGameEngine, but got overcome by the C++ polymorphism syntax. Now I know how to get over it.

  • @personsname0
    @personsname0 5 ปีที่แล้ว +5

    This really cleared up a few things from my OOP class (even though it was taught in Java), cheers mate!
    BTW, did I hear you say that you were going to do more assembly and FPGA?!? ;)

  • @ijudgeanime
    @ijudgeanime 5 ปีที่แล้ว +5

    I don't even program anymore but your videos are still entertaining! keep it up :)

    • @javidx9
      @javidx9  5 ปีที่แล้ว +2

      Thanks buddy, much appreciated! Though you should start programming again!

    • @ijudgeanime
      @ijudgeanime 5 ปีที่แล้ว +1

      @@javidx9 haha I actually majored in programming but I only occasionally do some web development as of recent. I decided to further my career in the more creative path so now I do a lot of designing and concepting but the logical thinking you get from programming still lingers within me XD. That and the fact that I am constantly thinking how my concept for a freaking pop-up store might have bugs in it so I'd better test it..... even though it is a drawing. Probably never gonna lose that haha

  • @ivelinkarageorgiev3111
    @ivelinkarageorgiev3111 3 ปีที่แล้ว

    I'm growing so much in love with this channel.

  • @ruben6284
    @ruben6284 5 ปีที่แล้ว +5

    At 8:05 I believe there must be an arrow operator (->) instead of a dot, because it is a pointer. But this is a great video, I learnt a lot!

    • @javidx9
      @javidx9  5 ปีที่แล้ว +3

      Thanks Ruben, yeah, its an ad-hoc pseudo scribble, though I should perhaps be more clear in the future!

    • @ruben6284
      @ruben6284 5 ปีที่แล้ว

      @@javidx9 I think most people will understand what you were doing. Great videos, keep up the good work!

    • @cyberpanda8813
      @cyberpanda8813 5 ปีที่แล้ว +2

      ​@@javidx9 Actually I'm learning C++, and i wonder how to draw in it in an easier way, thanks man! //Comming from C# -> Java and now C++ wish i've learned c++ first, this language is so AWESOME!

    • @khanhchung4103
      @khanhchung4103 5 ปีที่แล้ว +2

      trick pa Hey, why dont you check Chili C++ tutorials? He is also very awesome.

    • @cyberpanda8813
      @cyberpanda8813 5 ปีที่แล้ว +1

      @@khanhchung4103 ​ khanh chung Thank you! I didn't knew him, YES also awesome and hilarious sometimes hahaha, you kept that promise! THANKS

  • @amberheard2869
    @amberheard2869 5 ปีที่แล้ว

    I am happy that I am soon going to learn polymorphism.I am now on inheritance page (pg 500) and yeah you were right learning programming is by programming not only by reading books I found when programming in compiler I could read and understand them(code) and compile them in my head but when it is my turn to program in c++ I do silly mistakes ex: 1)function with no return type 2)forgetting about scope 3)forget to make warnings ex:catching exceptions for error (like when calculating 1/0) 4)Doing inf loop(forgetting anout condition) 5)range error and many more silly errors.I mostly do syntax error.I forget to mention my biggest mistake was forgetting to insert file for ifstream I just type string for it.I had hard making calculator that was tricky part.There are alot of interesting things happening when doing some programming project.I wish I will progress soon So that I can also do robotic stuff(which was my dream).It is fun (being::geek|nerd).I love your video it encourages me to do programming.I hope to become great mathematician programming is one of the way to excercise my brain for probem solving and thinking form different prespective.

  • @seebaastian
    @seebaastian 5 ปีที่แล้ว +1

    As usual, the most incredible explanation I ever seen about polymorfism. I hope you were my teacher. Thanks for your videos ;)

  •  2 ปีที่แล้ว

    This is one of the most inspiring and edutaining videos. I revisit it every now and then :)

  • @mohammadmahdifarnia5358
    @mohammadmahdifarnia5358 2 ปีที่แล้ว

    Oh my god, I haven’t seen anyone like you before in cpp
    1m 👍

  • @sunlighthurtsmyeyes9269
    @sunlighthurtsmyeyes9269 5 ปีที่แล้ว

    I've started learning OOP lately and this video helped me a lot, thank you very much

  • @rodolforodriguez70
    @rodolforodriguez70 12 วันที่ผ่านมา

    Thank very much for this great video

  • @tomkirbygreen
    @tomkirbygreen 5 ปีที่แล้ว +1

    Top video sir. Hope the Road Warrior lifestyle doesn't wear you down too much.

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Cheers Tom! Hopefully its all done with for a few months now

  • @streetfashiontv9149
    @streetfashiontv9149 3 ปีที่แล้ว

    That looks like a hotel room....hats off to you if that's your room it looks immaculate!

  • @streetfashiontv9149
    @streetfashiontv9149 3 ปีที่แล้ว

    That pixel game engine is epic i hope you can market it some more so it gets the exposure that it deserves like godot etc. Well done this is your seminal work...

  • @MellexLabs
    @MellexLabs 5 ปีที่แล้ว +2

    Would be very interesting if you could cover design patterns within this application and discuss how relevant they are within OOP...

  • @federicopueblalarregle5791
    @federicopueblalarregle5791 5 ปีที่แล้ว +2

    Great video! Thank you very much.

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Thanks Federico!

  • @juliocesarchavezflores1684
    @juliocesarchavezflores1684 3 ปีที่แล้ว

    This example is awesome. I was wondering how CAD software works under the hood because I have worked in the development of some scripts to automate stuff on that kind of software but never had a chance to see how it could be developed from scratch and I really want to be involved in the development of open source softwares like FreeCAD or blender. Pretty neat, thanks for share it.

  • @RPG_Guy-fx8ns
    @RPG_Guy-fx8ns 2 หลายเดือนก่อน

    I would just make an array of floats, and an array of integers.
    the floats hold all the vertex locations, the integers hold operation IDs, index, and length.
    basically the array of integers becomes a scripting language that renders sections of the vertex array as shapes.
    You don't need any classes or polymorphism, just a big switch case of operations.

  • @PflanzenChirurg
    @PflanzenChirurg 5 ปีที่แล้ว +3

    I need to give you a huge thanks for your c++ videos, im currently in transition to earn money with my selftaugh knowledge. Your Videos give me a roundup on a decent level

  • @conkerconk3
    @conkerconk3 4 ปีที่แล้ว

    if some want some hefty polymorphism, check out c# wpf. A button inherits a ContentControl which inherits a Control which inherits a FrameworkElement which inherits a UIElement which inherits a Visual (a drawable 'thing') which inherits a DependencyObject which inherits a DispatcherObject (UI stuff isn't very thread safe).

  • @videomashup2759
    @videomashup2759 5 ปีที่แล้ว +1

    If you are ever out of ideas on what topic to cover... a code-it-yourself simple programming language and compiler would be awesome!

  • @AnalyzeForSafety
    @AnalyzeForSafety 3 ปีที่แล้ว

    Wow, just wow... this tutorial is sooo cool!
    Thank you, really thank you!

  • @petercsala
    @petercsala 5 ปีที่แล้ว +4

    You knew it deep down, I was gonna be here

    • @javidx9
      @javidx9  5 ปีที่แล้ว +3

      I feel you are always with me buddy!

  • @conor63
    @conor63 5 ปีที่แล้ว +1

    this is excellent! i was just about to post on discord for some advice cause ive been stuck with polymorphism for a while!

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      lol Conor, you can post anyway! Easier than discussing via you tube for sure!

  • @johnernest8109
    @johnernest8109 2 ปีที่แล้ว

    This is really interesting. I've been wanting to make a 3D CAD program for a while somewhat like Rhino3D that handles things like variable fillets.

  • @juliankandlhofer7553
    @juliankandlhofer7553 4 ปีที่แล้ว

    wow those 40 mins went by very quick!
    great tutorial :)

  • @imuny6579
    @imuny6579 3 ปีที่แล้ว +2

    Why man so smart?
    Btw, love all of your content 😁👌👍

  • @kamaladdinahmadzada9965
    @kamaladdinahmadzada9965 5 ปีที่แล้ว +1

    Another great video again Thank U!

  • @__hannibaal__
    @__hannibaal__ ปีที่แล้ว

    Hi. A big things start from small thing; Thanks.

  • @BradenBest
    @BradenBest 2 ปีที่แล้ว

    23:20 yes I would agree that &ptr[offset] is bad, at least when ptr[offset] is equivalent to *(ptr + offset), because you could write it as just `ptr + offset`. You can't do that with C++ vectors, so in my opinion, `&vec . at(idx)` is MUCH preferable to `&vec[idx]` because it makes it very clear what is happening and can't be mistaken for a dereference + reference, meaning it's less likely to be mistakenly refactored or even thought about. &ptr[offset] is just asking to be rewritten (or thought about being rewritten) as ptr + offset, because in the general sense, [] and & cancel each other out. And if that breaks the code then it's on you for writing expressions that look like they can be simplified.
    Rant time.
    Honestly operator overloading is one of C++'s worst features. I have a lot of problems with C++, but the two biggest things that I hate about C++ are operator overloading and the programmers that saturate the language who don't know what they're doing, universally insist that C++ is a superset of C when this is demonstrably false, and seem to think they are experts because they can write C++. Not even good C++. Just the fact that they can write a 400 line spaghetti main function that spits out 40 different compiler warnings _but runs_ is enough for them to think they are an authority.
    But lets focus back on operator overloading, because I really want to illustrate why it frustrates me. It sounds like a good idea in theory, but in practice, it's used for horrible things like left shifting a value somehow being synonymous with inserting its string representation into the lhs file (std::cout

  • @juancasadoballesteros
    @juancasadoballesteros 5 ปีที่แล้ว

    Great video as always!!!!
    Lately I have been working on an algorithm from which i would love to see your approach. You might not be interested on it and that wold be fine but lately this problem has been the main thing on my mind so i am still recovering of only talking about it. The algorithm gets the curve created by a 2D plane intersecting the shape inferred from a bunch of 3D points over a grid.
    The points represent Signal loss over a 2D plane and the intersecting planes are the threshold that determine the category of the signal quality. On another words there are a lot of dots with the shape of little mountains and the need is to get the points that determine the curve that the function that could have generated the points wold have made on a plane on the threshold height with as much accuracy as posible.
    Thanks in advice if you comment back on me.
    PS: a video about your approach of the problem would be amazing :D

  • @l0gikk
    @l0gikk 5 ปีที่แล้ว +1

    My left ear loved this

  • @ac11dc110
    @ac11dc110 3 ปีที่แล้ว

    a full featured CAD software! wow!

  • @kksrinivas24
    @kksrinivas24 4 ปีที่แล้ว +1

    These videos are so helpful. Thanks a lot. I wish we have auto like for all your videos....

    • @javidx9
      @javidx9  4 ปีที่แล้ว

      Thank you Krishna!

  • @WizardOfArc
    @WizardOfArc 5 ปีที่แล้ว +1

    This one is lovely!

  • @BradenBest
    @BradenBest 2 ปีที่แล้ว

    C does not have polymorphism, but I could still think of an elegant way to handle similar classes of data
    enum shape_type {
    SHAPE_RECTANGLE,
    SHAPE_SQUARE,
    SHAPE_CIRCLE,
    SHAPE_POINT,
    SHAPE_END
    };
    struct shape {
    enum shape_type type;
    double coords[2];
    double sides[2];
    };
    static char const *shape_type_str[SHAPE_END] = {
    "Rectangle",
    "Square",
    "Circle",
    "Point",
    };
    static int (*shape_draw_methods[SHAPE_END])(struct shape const *shape) = {
    shape_rectangle_draw, // static int shape_rectangle_draw(struct shape const *shape)
    shape_rectangle_draw, // we can reuse
    shape_circle_draw,
    NULL,
    };
    void
    shape_draw(struct shape *s)
    {
    // common code goes here
    if (shape_draw_methods[s->type] == NULL)
    return; // no method to call, we're done
    if(!shape_draw_methods[s->type](s))
    // a method returning 0 is a handy way of indicating failure to the caller
    }
    static inline double *
    shape_radius(struct shape *s)
    {
    return s->sides;
    }
    And that's the basic structure. It's certainly a different design pattern. Instead of inheriting from a base class or creating a state machine/switch, we factor out the differences into their own functions and have a generic function do all the common stuff and just call the relevant function. We can define a single function for drawing a rectangle and take advantage of the fact that a square IS a rectangle to just reuse the same function, and then for shape types that don't need to add their own special behavior, we can just set its function pointer to NULL. Even in a language without polymorphism, clean modular design is still very much possible ;)
    I threw the shape_radius function in to show that we don't need to stuff a million properties into a struct or overcomplicate things with unions (although a union is a valid way to assign multiple mutually exclusive types and names to the same space, and simply agreeing that a circle's sides[0] is its radius is valid, too). We could just get the pointer and call it the radius. If the shape code is meant to make shapes a mostly opaque type, we can get away with things like this, because it's not the caller's business to know how the radius is defined, but then on the implementation side, we have a consistent language for what constitutes the radius.

    • @ShadowRadiance
      @ShadowRadiance 11 หลายเดือนก่อน

      if instead of prefixing the data in `struct shape` with a typecode, you had a "type info" and a pointer to an array of function pointers (for the virtual functions of the class), and set up each Line as being a Shape with a type id of Line and pointer to the "Line table of virtual function pointers" (call it a vtable), you'd basically have what c++ is doing behind the scenes for you.
      That is, implementing a per-class vtable (if virtual functions exist in the class) and sticking the type information (for dynamic-casting) and a pointer to the vtable as a prefix to the object.
      You'd then call the "right override" by using `pShape->pVtable->pFunction()`.
      Since C structs can be happily cast to any struct with the same members in the same order, voila c++ style polymorphism in C.

  • @k6l2t
    @k6l2t 3 ปีที่แล้ว

    Polymorphism was fun for a while, and then realized it has the cost of losing control of the structure of your program's memory, which I find quite unattractive. Nowadays I'm more of a fan of tagged unions for this kind of thing, since you get polymorphic behavior without losing control of what memory goes where. Modern OOP just doesn't satisfy me anymore...

  • @minecraftermad
    @minecraftermad 3 ปีที่แล้ว +2

    I first read that as practical polytheism and was just slightly confused

  • @orangasli2943
    @orangasli2943 2 ปีที่แล้ว

    @28:52
    Ok now I understand I need to pass this

  • @jgcooper
    @jgcooper 5 ปีที่แล้ว +1

    Could you do a video telling us about your chromebook?
    What are the specs, what OS and environment are you using? (how did you set it up)
    What is it able to do, and what do you use it for?
    I was under the impression that they were just web browser machines, and I'm a bit intrigued now.

    • @IgnoreSolutions
      @IgnoreSolutions 5 ปีที่แล้ว

      It is possible to run a full Linux DE inside of ChromeOS. I've done it before on a first gen ARM Samsung Chromebook, it's not very practical or useful but it's something. I have yet to see one running windows.

  • @TylerMatthewHarris
    @TylerMatthewHarris 5 ปีที่แล้ว +4

    Could you do a video about coding the Fourier Transform?

  • @jsflood
    @jsflood 5 ปีที่แล้ว

    Great video! The phase was perfect :-)

  • @tomay3000
    @tomay3000 5 ปีที่แล้ว +2

    Where to get the most common and correct names (words) often used when creating an application?
    For example I would have used : "dot" instead of "node" because I am not a native english speaker.
    And that's I also do care about code quality when sharing it.

    • @javidx9
      @javidx9  5 ปีที่แล้ว +1

      Hmmm. Thats a very tricky and interesting question. To my shame i can only speak English, so this is something ive never considered before...

    • @matheusmarchetti628
      @matheusmarchetti628 4 ปีที่แล้ว +1

      Kinda late, but I hope it will still be useful. If you're developing an app that represents something real, do a Google search about the real thing and learn how other countries calls things. As a brazilian engineer, I have to do it all the time, and I can deeply relate to your comment

  • @andrewminai6094
    @andrewminai6094 5 ปีที่แล้ว +1

    Love your channel

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Cheers Andrew!

  • @drcongoheartofafrica7175
    @drcongoheartofafrica7175 5 ปีที่แล้ว +1

    Javidx9.. thanks a million for this video. it has cleared a lot for me for what I want to use C++ for. I use CAD software packages a lot in my job and wanted to have a pet project designing a Railways/Road alignment CAD package. I need to understand how to draw shapes (lines, circular curves, transition curves, parabolic curves and how to join them up and perform calculations). can I do this without a Kernel ? I'll tell you 10 years from now if I get anywhere near replacing my current engineering CAD package...Top man

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      lol DRCongo, drawing shapes is not too difficult, most graphics libraries will have more than enough for you, but if you want to do things the hard way, you can always check out Bresenhams Line and Circle Drawing algorithms - a great place to start.

  • @mmx555
    @mmx555 5 ปีที่แล้ว

    @javidx9, You are a mentor to me.
    thank you.

  • @acho8387
    @acho8387 4 ปีที่แล้ว

    Thank god you're not in your usual setup. Now your neck can get a breather.

  • @soethihanaing123
    @soethihanaing123 4 ปีที่แล้ว

    Greate Video

  • @kuhluhOG
    @kuhluhOG 5 ปีที่แล้ว

    Now a question:
    If wrote something for test purpose:
    #include
    #include
    class A {
    public:
    virtual void DoSomething(int a = 5) { std::cout

    • @TheMrDemonized
      @TheMrDemonized ปีที่แล้ว

      Default parameters are not 'virtualized' so if you have a pointer to A, it will print a default param defined in A, 5. If you want to print 6,you need to cast A* to B* via static_cast

  • @Ownage4lif31
    @Ownage4lif31 5 ปีที่แล้ว +2

    So I barely program in c++ but I have a question. Because in c++, using the new keyword allocates memory to the heap. I don't really see the memory being deleted here once used, unless this is handled internally by your game engine?
    I've not been able to look at the actual code since I'm not home atm. I'd just like to understand this a bit more. Just so I know I'm on the right page.
    Other than that, this video helps me a lot!

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      As this is just a demo, and there is no facility to remove objects, there is little need and more accurately no sensible place to delete them. Any claimed memory is released when the process exits. Extending the demo to support more tools such as delete would then give you such options.

    • @Ownage4lif31
      @Ownage4lif31 5 ปีที่แล้ว

      javidx9 OK cool. Thanks for the reply. Makes sense now!

    • @climatechangedoesntbargain9140
      @climatechangedoesntbargain9140 5 ปีที่แล้ว

      why not just default to make_unique()?

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      In this instance it doesnt give me anything over and above whats already there. ie the process will terminate before there is opportunity to descope any smart pointers. But also, if i were to add additional functionality, i may want multiple ownership of the object to facilitate grouping, copy and paste etc, undo etc.

    • @climatechangedoesntbargain9140
      @climatechangedoesntbargain9140 5 ปีที่แล้ว

      ​@@javidx9It does not give you anything more in this case, but it also does not take anything from you, right now. Regarding the additional functionality: Currently you don't have that functionality, and as soon as you have it, you can still "upgrade" to shared pointers if needed. In this case, defaulting to UP even helps you, since you will run into problems faster.
      Thus, it will help you in the future: Less risk of memory mismanagement, less work in the future (when you have to switch and refactoring in case you forget thinking about ownership).
      I don't know why you would not want to default to UQ.
      PS: For copying (shapes) you probably want to have a real copy instead of shared ownership ;)

  • @alfiewhitson7726
    @alfiewhitson7726 5 ปีที่แล้ว

    @javidx9 really interesting video, very enjoyable however could u in future put a bit of de-esser on your audio in post because the white noise occuring when you pronounce the letter 's' is practically sawing my eardrums in half

  • @m4rt_
    @m4rt_ ปีที่แล้ว

    luckily ive used java in the past, so I already understand this :)

  • @NicolaiSyvertsen
    @NicolaiSyvertsen 5 ปีที่แล้ว +1

    I was using polymorphism a long time before I actually knew it was called polymorphism. I just learned about interfaces. Primarily in relation to COM programming. Typical nomenclature from academia that us mere practical programmers don't care much about.

  • @ashrasmun1
    @ashrasmun1 5 ปีที่แล้ว +3

    This is DYNAMIC polymorphism. You can use STATIC polymorphism to some extent, and it is way more preferable in the realm of game development.

  • @oleksijm
    @oleksijm 5 ปีที่แล้ว

    Why am I watching this, I can't even code..
    Or well, I can't yet, but want to learn to. Thanks for this interesting video.

    • @rj-nj3uk
      @rj-nj3uk 5 ปีที่แล้ว

      @saladnuts start with assembly programming 👹

  • @Spartan322
    @Spartan322 5 ปีที่แล้ว +2

    Aren't you suppose to delete the pointers within the vector? (or list) (lists and) vectors don't destroy pointers and while it is a small program, isn't that still bad practice?

    • @javidx9
      @javidx9  5 ปีที่แล้ว +1

      Of course you should delete pointers, but in this small demonstration i have no scope for doing so as i dont capture the exit condition, nor do i give the user any facility for removing objects. Since the only sensible exit in the demo shown is process termination, ill let the OS handle it.

  • @eformance
    @eformance 5 ปีที่แล้ว

    I'm disappointed we didn't see Superman running around in the background!

  • @renderfuture6152
    @renderfuture6152 3 ปีที่แล้ว

    coool! nice

  • @heliosgames6665
    @heliosgames6665 4 ปีที่แล้ว

    Hello Javidx9, small question about your GetNextNode function, why use vecNodes[vecNodes.size() - 1] instead of vecNodes.back(); ? both should give the same result ? so does this mean its purely for ease of reading the code?
    thank you for your videos,

  • @fengwang9752
    @fengwang9752 5 ปีที่แล้ว +1

    8:19 vecObjects[2] is a pointer to A, how can you vecObjects[2].DoSomething() ?

    • @MattZelda
      @MattZelda 5 ปีที่แล้ว

      It's basically the same as
      A->doSomething()

  • @ashwiniabhishek1504
    @ashwiniabhishek1504 3 ปีที่แล้ว

    Compiler decides at run time can that happen??, I thought compiler job is to compile

  • @trueverdicts685
    @trueverdicts685 5 ปีที่แล้ว +3

    javidx9 do you use any other programming language other than C++?
    Also, what languages do you know other than C++?

  • @trafficface
    @trafficface 5 ปีที่แล้ว

    I am surprised to say I have stayed in nicer hotel rooms for work. But I drew the long straw and got the room with 2 double beds 🤣

  • @robertboran6234
    @robertboran6234 5 ปีที่แล้ว

    Also is there any code automation tool for C++ to somehow generate based on a goal (set by the programmer) and a based class a polymorphic scheme using AI ? Or if you already have code but you don't use polymorphism to somehow automatically generate a polymorphic version of your code ?

  • @daanielacosta2395
    @daanielacosta2395 5 ปีที่แล้ว

    At 38:16 i was getting scared, i thought what happened here xD

  • @tmbarral664
    @tmbarral664 3 ปีที่แล้ว

    @javidx9 As we have probably always a single pge, it would be better to pass the parm once in the constructor rather than to each Draw() calls. Or the same way you used for worldoffset, as static.... but that's not very elegant

    • @javidx9
      @javidx9  3 ปีที่แล้ว

      Do it however you wish...

    • @tmbarral664
      @tmbarral664 3 ปีที่แล้ว

      ​@@javidx9 ;) ok, David, of course. But I was thinking about the meaning of this.
      To pass the pge as a parm means that it can be different for any other calls. That conveys the possibility of many pges. That's fine.
      But is it the intention here ? I was supposing no...I may be totally wrong, of course.
      What are your thoughts about it ?

  • @1m2u3s8
    @1m2u3s8 4 ปีที่แล้ว

    grazie

  • @anonymoussloth6687
    @anonymoussloth6687 2 ปีที่แล้ว

    If i have a parent class that has some functionality and then a child class extends it and adds new functions, how can I call those functions at runtime using polymorphism? I know one way is to cast it, but what if I don't know what child to cast it to at compile time?
    For example, if i have a class parent which has 2 children: child1 and child2.
    Child1 has foo() and child2 has bar() and these methods are not available in the parent. I have a function that receives a parent pointer and based on which class that points to, call foo or bar.

    • @javidx9
      @javidx9  2 ปีที่แล้ว

      You can only call functions on classes for which they are defined. So in short, without casting, you can't do what you are asking. A pattern around this is to store in the base class an enumeration of the type, populated by subclasses at construction. This way you have enough "reflection" to determine which cast to use, though caution, this could indicate a flaw with your encapsulated design.

  • @ross9263
    @ross9263 4 ปีที่แล้ว +1

    Wait couldnt you just have a completely abstract class that is filled with virtual functions? Then if you make different subclasses you can put them all into one vector. Im not sure what you would do with that because none of them would be related, but could you?

    • @javidx9
      @javidx9  4 ปีที่แล้ว

      Sure, that is polymorphism!

    • @PetrPss
      @PetrPss 4 ปีที่แล้ว

      Every subclass has to define all functions marked as virtual. Or it'll be abstract itself.

  • @laureven
    @laureven 5 ปีที่แล้ว +1

    Every single time when I have the impression that I know something, after watching Your video I'm quickly put back on earth ....is it even possible to become a programmer after 35 if You starting from scratch ?? :) for me this is like looking at the universe ...You can have the impression that you know the region up to the moment when somebody presses the zoom function on the telescope :)

    • @wiktorwektor123
      @wiktorwektor123 4 ปีที่แล้ว +1

      You can't be championship level sport guy at this age, but you can definietly be a programmer. If you wan't to try make games, try godotengine.org/ It's free and GDscript is very easy to learn

  • @joshinils
    @joshinils 5 ปีที่แล้ว

    seeing you write out "The End" made me think of a question i had for a while:
    how does a pdf work?
    how is the information that is to be displayed encoded and how is it then displayed?
    i can encode text, images, scalable vector images etc. and i have done so to some extent with LaTeX.
    some of those things i generated are not standard elements of any form. how does my printer then know how to print the same thing the way i defined them and saw them on my screen?

    • @UberMun
      @UberMun 5 ปีที่แล้ว

      PDF is a fancy wrapper for a thing developed by Adobe called PostScript. Modern printers have built-in post-script interpreters to comply with Adobe's standard.

    • @joshinils
      @joshinils 5 ปีที่แล้ว +1

      ​@@UberMun right, which is apparently a turing complete language in itself...
      so making an interpreter for PostScript would be more than an afternoon project

    • @Nohbdy_Ahtall
      @Nohbdy_Ahtall 5 ปีที่แล้ว

      I recommend looking into "LaTeX"! I recently learned a lot more about this world. The simplest I can kinda explain it is rather telling you what I used. I downloaded a program called "Lyx" which also required me to download/install "MiKTeX". Lyx seems decently easy to understand, and you can see the "code" of the document as you write it.
      Anyway, it has like... multiple types of PDF-isms which turn this code into PDF, however it also turns it into HTML or word-like document, etc. I think simply using this made me understand PDFs better, but especially about typesetting and how one would actually write a book.
      Lots of layout-oriented thinking involved ,or - perhaps it is recommended you "don't" think about it, it seems the point of this stuff is partially so you can just focus on the content of the book, not the layout.

  • @hound4425
    @hound4425 5 ปีที่แล้ว

    Shouldn't at 8:20 be Objects[2]->DoSomething() instead of dot as it's a pointer?

    • @fredhair
      @fredhair 5 ปีที่แล้ว +1

      Pretty sure square brackets dereferences the pointer much like using -> or (*ptr). member. At 23:31 you can see he uses the & (address of/ reference operator) in front of array[size_t] to return a pointer. E.g. &array[0] gets the address of first element whereas array[0] returns the value of first element. Note passing &array[0] would be same as passing array to a function taking pointer type, and array[0] is the same as *array (first value of array).

  • @Veso266
    @Veso266 5 ปีที่แล้ว +1

    Does your salary justify your work (traveling all the time, etc)?

    • @javidx9
      @javidx9  5 ปีที่แล้ว +2

      The job is interesting and reasonably unique.

  • @amberheard2869
    @amberheard2869 5 ปีที่แล้ว

    How to self study computer science plwase recommend me books list plus please sort them I want to learn it from beginning to end

  • @jragomaster25
    @jragomaster25 5 ปีที่แล้ว

    nice, maybe in a future video add an exporter to .svg?

  • @whmlprod
    @whmlprod 4 ปีที่แล้ว +1

    Nobody else is confused by the fact he's sitting behind a potato chromebook, while programming on a what appears to be a full blown windows device... Lmao

    • @javidx9
      @javidx9  4 ปีที่แล้ว +1

      Potato? My chromebook is awesome, and its rdp capabilities work just fine!

    • @whmlprod
      @whmlprod 4 ปีที่แล้ว

      @@javidx9 Wasn't sure if it was just for cinematic purposes or not lol. Love your vids btw!