Тёмный

Practical Polymorphism C++ 

javidx9
Подписаться 315 тыс.
Просмотров 125 тыс.
50% 1

Polymorphism is a powerful yet potentially confusing feature of C++. In this video I create a simple Computer Aided Design (CAD) application that exploits polymorphism to keep the application simple yet highly customiseable.
Source: github.com/OneLoneCoder/Javid...
RU-vid: / javidx9
/ javidx9extra
Discord: / discord
Twitter: / javidx9
Twitch: / javidx9
GitHub: www.github.com/onelonecoder
Patreon: / javidx9
Homepage: www.onelonecoder.com

Наука

Опубликовано:

 

2 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 234   
@martinofeldman1039
@martinofeldman1039 5 лет назад
You are a very clever guy. And I realized that my brain needs some upgrade...
@javidx9
@javidx9 5 лет назад
lol thanks Martino :D Download some more brain!
@sweetberries4611
@sweetberries4611 5 лет назад
@@javidx9 Like, download more ram?
@yassine321
@yassine321 5 лет назад
U should see the appropriat requirements system for ur old end brain
@theternal
@theternal 4 года назад
@@javidx9 plz link
@ananttiwari1337
@ananttiwari1337 3 года назад
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 года назад
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 $$$.
@BinkiklouGaminglol
@BinkiklouGaminglol 5 лет назад
You are very smart, placing the camera infront of the mirror is genius.
@kushagra64
@kushagra64 3 года назад
I really didn't realized that :0
@leerv.
@leerv. 3 года назад
Polymorphism literally means "many shape"-ism, so this seems like the perfect implementation of an example. :)
@KingdomBusiness21
@KingdomBusiness21 5 лет назад
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 лет назад
Incredibly kind words Kirk, much appreciated and im pleased you found it useful.
@KiAb0n0V
@KiAb0n0V 5 лет назад
@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.
@EmmanuelMayor
@EmmanuelMayor 3 года назад
Man, of all the programmers I've been seeing on RU-vid, 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.
@orfeasliossatos
@orfeasliossatos 5 лет назад
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!
@arcnaver
@arcnaver 5 лет назад
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.
@rfdave3980
@rfdave3980 3 года назад
You have explained the concept very well, Dave. It is a difficult thing to get your head around. Thank you !
@ivelinkarageorgiev3111
@ivelinkarageorgiev3111 2 года назад
I'm growing so much in love with this channel.
@seebaastian
@seebaastian 5 лет назад
As usual, the most incredible explanation I ever seen about polymorfism. I hope you were my teacher. Thanks for your videos ;)
@abhishekgy38
@abhishekgy38 5 лет назад
@javidx9 This is top notch, sir. I'm happy I came across your channel.Looking forward to more of these.
2 года назад
This is one of the most inspiring and edutaining videos. I revisit it every now and then :)
@leonardochiruzzi7642
@leonardochiruzzi7642 5 лет назад
This is just what I was looking for. I've banged my head for years. A million thanks!
@javidx9
@javidx9 5 лет назад
I hope you find it useful Leonardo, its not the easiest topic to deliver via video :D
@sunlighthurtsmyeyes9269
@sunlighthurtsmyeyes9269 5 лет назад
I've started learning OOP lately and this video helped me a lot, thank you very much
@kamaladdinahmadzada9965
@kamaladdinahmadzada9965 5 лет назад
Another great video again Thank U!
@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.
@skilz8098
@skilz8098 4 года назад
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.
@AnalyzeForSafety
@AnalyzeForSafety 3 года назад
Wow, just wow... this tutorial is sooo cool! Thank you, really thank you!
@delofon
@delofon 4 года назад
I think I now understand inheritance and polymorphism, at least, a bit better (finally). Ty for educating us all!
@federicopueblalarregle5791
@federicopueblalarregle5791 5 лет назад
Great video! Thank you very much.
@javidx9
@javidx9 5 лет назад
Thanks Federico!
@jsflood
@jsflood 5 лет назад
Great video! The phase was perfect :-)
@juliankandlhofer7553
@juliankandlhofer7553 4 года назад
wow those 40 mins went by very quick! great tutorial :)
5 лет назад
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 :)
@WizardOfArc
@WizardOfArc 5 лет назад
This one is lovely!
@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!
@SaifUlIslam-db1nu
@SaifUlIslam-db1nu 5 лет назад
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 лет назад
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 лет назад
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!
@conor63
@conor63 5 лет назад
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!
@ijudgeanime
@ijudgeanime 5 лет назад
I don't even program anymore but your videos are still entertaining! keep it up :)
@javidx9
@javidx9 5 лет назад
Thanks buddy, much appreciated! Though you should start programming again!
@ijudgeanime
@ijudgeanime 5 лет назад
@@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
@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 RU-vid. 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
@onogrirwin
@onogrirwin Год назад
shoutout to that snazzy telephone on the nightstand. To it, C is a brand new high level language.
@personsname0
@personsname0 4 года назад
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?!? ;)
@andrewminai6094
@andrewminai6094 5 лет назад
Love your channel
@javidx9
@javidx9 5 лет назад
Cheers Andrew!
@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.
@imuny6579
@imuny6579 3 года назад
Why man so smart? Btw, love all of your content 😁👌👍
@petercsala
@petercsala 5 лет назад
You knew it deep down, I was gonna be here
@javidx9
@javidx9 5 лет назад
I feel you are always with me buddy!
@tomkirbygreen
@tomkirbygreen 5 лет назад
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
@l0gikk
@l0gikk 5 лет назад
My left ear loved this
@mohammadmahdifarnia5358
@mohammadmahdifarnia5358 2 года назад
Oh my god, I haven’t seen anyone like you before in cpp 1m 👍
@kksrinivas24
@kksrinivas24 4 года назад
These videos are so helpful. Thanks a lot. I wish we have auto like for all your videos....
@javidx9
@javidx9 4 года назад
Thank you Krishna!
@greatbullet7372
@greatbullet7372 5 лет назад
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
@DeepFriedOreoOffline
@DeepFriedOreoOffline 7 дней назад
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!
@streetfashiontv9149
@streetfashiontv9149 3 года назад
That looks like a hotel room....hats off to you if that's your room it looks immaculate!
@ac11dc110
@ac11dc110 3 года назад
a full featured CAD software! wow!
@mmx555
@mmx555 5 лет назад
@javidx9, You are a mentor to me. thank you.
@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...
@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
@NeilRoy
@NeilRoy 5 лет назад
Very nice explanation. I'm still more of a straight C man though.
@tomershechner
@tomershechner 4 года назад
I'm a gay C man
@GabrielPiveta
@GabrielPiveta 4 года назад
haha i see your comments all over the internet
@juliocesarchavezflores1684
@juliocesarchavezflores1684 2 года назад
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.
@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.
@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.
@soethihanaing123
@soethihanaing123 3 года назад
Greate Video
@MellexLabs
@MellexLabs 5 лет назад
Would be very interesting if you could cover design patterns within this application and discuss how relevant they are within OOP...
@videomashup2759
@videomashup2759 5 лет назад
If you are ever out of ideas on what topic to cover... a code-it-yourself simple programming language and compiler would be awesome!
@revealingfacts4all
@revealingfacts4all 5 лет назад
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!
@__hannibaal__
@__hannibaal__ Год назад
Hi. A big things start from small thing; Thanks.
@TylerMatthewHarris
@TylerMatthewHarris 5 лет назад
Could you do a video about coding the Fourier Transform?
@renderfuture6152
@renderfuture6152 3 года назад
coool! nice
@minecraftermad
@minecraftermad 3 года назад
I first read that as practical polytheism and was just slightly confused
@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
@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).
@ruben6284
@ruben6284 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 лет назад
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 лет назад
​@@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 лет назад
trick pa Hey, why dont you check Chili C++ tutorials? He is also very awesome.
@cyberpanda8813
@cyberpanda8813 5 лет назад
@@khanhchung4103 ​ khanh chung Thank you! I didn't knew him, YES also awesome and hilarious sometimes hahaha, you kept that promise! THANKS
@jgcooper
@jgcooper 5 лет назад
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.
@eformance
@eformance 5 лет назад
I'm disappointed we didn't see Superman running around in the background!
@heliosgames6665
@heliosgames6665 3 года назад
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,
@drcongoheartofafrica7175
@drcongoheartofafrica7175 5 лет назад
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.
@1m2u3s8
@1m2u3s8 4 года назад
grazie
@orangasli2943
@orangasli2943 Год назад
@28:52 Ok now I understand I need to pass this
@Spartan322
@Spartan322 5 лет назад
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 лет назад
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.
@jragomaster25
@jragomaster25 5 лет назад
nice, maybe in a future video add an exporter to .svg?
@just_epo
@just_epo 4 года назад
big brain time
@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 ?
@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 4 года назад
@saladnuts start with assembly programming 👹
@BradenBest
@BradenBest Год назад
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
@jamesgrimwood1285
@jamesgrimwood1285 5 лет назад
I've got one of those Chromebooks :)
@luismaschietto
@luismaschietto 4 года назад
Is ot good for development? Because all olc videos are recorded on windows. Chromebook uses Chrome OS
@BradenBest
@BradenBest Год назад
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 9 месяцев назад
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.
@m4rt_
@m4rt_ Год назад
luckily ive used java in the past, so I already understand this :)
@acho8387
@acho8387 3 года назад
Thank god you're not in your usual setup. Now your neck can get a breather.
@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 🤣
@tomay3000
@tomay3000 4 года назад
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 4 года назад
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 3 года назад
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
@Ownage4lif31
@Ownage4lif31 5 лет назад
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
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
​@@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 ;)
@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 лет назад
​@@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.
@daanielacosta2395
@daanielacosta2395 5 лет назад
At 38:16 i was getting scared, i thought what happened here xD
@factory_enslavement
@factory_enslavement 3 года назад
What's the name of the track from the video called "How a glock works"
@Magikookeven
@Magikookeven 4 года назад
Like!
@fengwang9752
@fengwang9752 4 года назад
8:19 vecObjects[2] is a pointer to A, how can you vecObjects[2].DoSomething() ?
@MattZelda
@MattZelda 4 года назад
It's basically the same as A->doSomething()
@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 10 месяцев назад
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
@Veso266
@Veso266 4 года назад
Does your salary justify your work (traveling all the time, etc)?
@javidx9
@javidx9 4 года назад
The job is interesting and reasonably unique.
@ashwiniabhishek1504
@ashwiniabhishek1504 3 года назад
Compiler decides at run time can that happen??, I thought compiler job is to compile
@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...
@hound4425
@hound4425 5 лет назад
Shouldn't at 8:20 be Objects[2]->DoSomething() instead of dot as it's a pointer?
@fredhair
@fredhair 5 лет назад
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).
@MrBoBiNaToR1000
@MrBoBiNaToR1000 3 года назад
Can anyone explain how the equations at 20:01 work?
@ProgrammerSheep
@ProgrammerSheep 5 лет назад
How are you doing that with a Chromebook?
@nextlifeonearth
@nextlifeonearth 5 лет назад
Remote desktop or he installed Windows on it.
@AllenKll
@AllenKll 5 лет назад
Same question... Can you install windows on an Acer Chromebook? It's pretty zippy to be vnc.
@victornoagbodji
@victornoagbodji 4 года назад
same question
@laureven
@laureven 5 лет назад
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 года назад
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
@MrQcomber
@MrQcomber 3 года назад
Do we not need to delete the nodes created using "new"?
@mr.osamabingaming2633
@mr.osamabingaming2633 2 года назад
I believe so.
@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 ?
@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
@trueverdicts685
@trueverdicts685 5 лет назад
javidx9 do you use any other programming language other than C++? Also, what languages do you know other than C++?
Далее
Tinkering With Spirographs in C++
22:01
Просмотров 11 тыс.
Object Oriented Programming is Good | Prime Reacts
31:30
Forbidden C++
33:07
Просмотров 1 млн
What Are Pointers? (C++)
41:55
Просмотров 559 тыс.
Brute Force Processing
52:50
Просмотров 155 тыс.
why does inheritance suck?
8:05
Просмотров 204 тыс.
how Google writes gorgeous C++
7:40
Просмотров 803 тыс.
Улучшил свои Apple Watch!
0:25
Просмотров 36 тыс.