#30 OOP Part-2: Inheritance in C and C++

preview_player
Показать описание
This second lesson on Object-Oriented Programming (OOP) introduces the concept of Inheritance, which is a mechanism for reusing common attributes and operations among classes. You'll see how you can emulate Inheritance in C, what kind of code is generated, and how to debug such code. Next, you will translate the C design into C++ using a class and again you inspect the generated code to compare it with C. Finally, you will see how to *think* about inheritance and not confuse it with class composition.

------
Resources:

Companion web page for this video course:

GitHub repository for projects for this video course:

Transcript of this lesson:

Music credits:
The background music comes from:
Рекомендации по теме
Комментарии
Автор

NOTE: The source code, as presented in the video, might cause compilation errors with the newer MDK-ARM / uVision toolsets. This is because the underlying compiler in MDK-ARM has been changed to "Compiler-6", while the older "Compiler-5" is considered now obsolete. The updated code that compiles cleanly with "Compiler-6" is available from the companion website at:


and from GitHub:

StateMachineCOM
Автор

Best lessens I have ever encountered on OOP, this is the right way to teach OOP, starting from scratch!

mehdisafar
Автор

thank you Miro, it was a great pleasure watching this episode of the great embedded systems programming series

EngMazen
Автор

Thanks Miro. Your lessons in ARM are the best lessons I ever had in my entire embedded career. I learn a lot in your series of lessons. Please keep posting new video for this series. or other related videos in embedded systems. such as embedded design best practices, embedded Linux/ embedded os, etc.. Thanks a lot. Long live :)

nolimangulabnan
Автор

All the content in your channel is fantastic, thank you!!

bonadio
Автор

Thanks Miro, your videos have been of immense help over the years. Very well structured and explained. For OOP, can you kindly consider the most basic project with a practical example of UML architecture of the project to explain how the thinking process of structuring OOP code in C/C++ works?
Thanks

badejavuade
Автор

Thanks for the awesome lesson.
Wouldn't it be better to always use &r1.super rather than upcasting (Shape *)&r1 to prevent misalignement and/or allow MI ?
If I have SI and MI in my project, it would look inconsistent to sometimes access super classes methods with upcasting or not.
What would you consider best practice in this case ?

aubinpougnant
Автор

Thanks Miro for the course. But i want a question for this subject. Why doest change x and y variable in rectangle draw function ? Before they were changed in shape move function. I missed this part.

muhammetalitekeci
Автор

Thanks for your videos. The greatest I've encountered. I have a question : why does it break encapsulation to use Shape_moveBy(&r1.super, 7, 9) instead of Shape_moveBy((Shape *)&r1, 7, 8). thanks again

aliounecamara-xi
Автор

I have another question. what if I inherit 2 or more classes (structs) in C and can I still upcast?

BinGanzLieb
Автор

why it is important to know that to transfer/switch between c and c++, i meant in the real application case.

josephzhang
Автор

Important Note:
void SysTick_Handler(void) -> extern "C" void SysTick_Handler(void)
and
void GPIOF_Handler(void) to extern "C" void GPIOF_Handler(void)
otherwise Keil wont find the handler and will run the weak handlers in the start up code.

moustafanofal
Автор

that was a great video. I also create simillar content.

pythonfinance
Автор

Excellent tutorial as always!
Luckily we are dealing with classes not Trumps...XD

zhitailiu
Автор

Can someone help me to create a clock generator using interrupts.It should be able to generate a clock over a wide range of frequencies.The frequencies should be available in a 1, 2, 5 step fashion from 1Hz to 2MHz(Table driven!)

ishankas