Your Ninth Day in C (Object Oriented Programming in C) - Crash Course in C Programming

preview_player
Показать описание

►Lesson Description: In this lessons I show you how you would program in an 'object-oriented' style in the C programming language. C as a general purpose language allows you to build 'language' features from scratch if you need them, or otherwise understand the programming paradigm. I think this lesson will show more of an appreciation of other languages, and otherwise understanding how language features are built from scratch can help give you more command over the language.

00:00 Introduction and code walk definition
1:20 Observing array_t data structure
2:20 The self and function pointers in array_t
3:15 Get and Set function and passing in struct as a pointer
5:12 The constructor or 'factory function' for creating array_t
7:30 Setting up our function pointers
9:20 Destructors to destroy our array_t
10:44 Using our array_t
12:40 A quick review again of array_t
14:24 The equivalent C++ code
20:01 Conclusion

►Please like and subscribe to help the channel!
Рекомендации по теме
Комментарии
Автор

Great content, excellent teacher. Thank you for the lessons. I sincerely appreciate your work.

Sergei_developer
Автор

I felt it from the get-go... something must be MAGIC about C language... Loving this series! Merci bcp

Ptr-NG
Автор

Very hard to find such well made video for C, thanks!!
After finished this video the only thing i want to do is finish this entire series, big love❤

张正-sv
Автор

Thank you Mike. This was a very valuable lesson for me. It gave me new insight on how OOP works.

viktornikolov
Автор

Thank you Mike for sharing knowledge, you're great help. I look forward to watching your tutorials and learning from everything you share.

steve
Автор

Great to see a howto make OOP in C. For me, the video also demonstrated the great power of a somewhat simple programming language.

I had learned multiple inheritance, composition ec. and is now enjoying learning C.

To understand this video, you have to have a good understanding of both languages.

grimvian
Автор

It's so much fun learning C watching your videos. Thank You.

dhanushs
Автор

I don't if anyone else has this problems, but I get confused sometimes by not knowing is something is a made up name or something that is used in c. To understand some of this I had google bard add foo to all the custom named thing

void foo_set_value(struct foo *array, size_t index, int value) {
array->elements[index] = value;
}

int foo_get_value(struct foo *array, size_t index) {
return array->elements[index];
}

void main() {
struct foo array;
int value = 10;

// Set the value of the element at index 0 to 10.
void (*foo_pfnSet)(struct foo *, size_t, int) = foo_set_value;
foo_pfnSet(&array, 0, value);

// Get the value of the element at index 0.
int (*foo_pfnGet)(struct foo *, size_t) = foo_get_value;
int result = foo_pfnGet(&array, 0);

printf("The value of the element at index 0 is %d\n", result);

steve
Автор

Hi mike! great series!
I like that the videos are very focused, organized and relatively short so it's easier to follow! it's also less overwhelming in this way :)
Moreover, for me it helps that you give visual explanations and definitions on your white board, easier to understand the information.
I wanted to ask Is there any chance that you can publish your coding examples from the videos so we can play with the code? or even just look at the code when needed, cause right now I'm scrolling through the video looking for the right lines I want to see and play with, and it's less convenient.
Thanks and keep publishing amazing content!

sm
Автор

It's a nice video,
But at 11:16 if you would have passed array_t instead of an struct array *, What happens? do you get an incomplete type?
You should have tried it in the video itself.

vb
Автор

Great video, I know C, But I don't know OOP, I can say my level in C is intermediate, and I'm now trying to learn C++, So my question is when it comes to C what are the pros and cons to code like that instead of the traditional way without that function pointer inside the struct, and could you please give a real life case when is better to code like this in C, thank you.

AMehdiKh
Автор

İsn't c procedure oriented programming language ?

yigit-xwto