How do you implement OOP in C Programming Language

How do you implement OOP in C Programming Language

linuxhint

2 года назад

17,007 Просмотров

OOP (Object-Oriented Programming) is a widely used Programming Concept, but it is missing in the Vanilla C Programming Language. This video, demonstrates how you can implement an OOP like modularity in the C Programming Language with the help of structure.

Тэги:

#implement_OOP #C_programming #oop_in_C_programming
Ссылки и html тэги не поддерживаются


Комментарии:

@princesschelsea1687
@princesschelsea1687 - 17.11.2023 14:16

If you still have to pass the structure pointer inside the parenthesis then there's NO point to this. Might as well go the normal route and just call the function without doing struct.get

Ответить
@riki4644
@riki4644 - 22.10.2023 14:23

Thank you so much

Ответить
@juniorlucival
@juniorlucival - 08.10.2023 03:07

forget const and static in files, for encapsulation

Ответить
@quanquoctruong1276
@quanquoctruong1276 - 01.07.2023 12:27

Ooooooh that actually is amazing, but I think that you can actually create constructors (and subsequently, destructors), by include all of the function bindings in the init() function. The destructor can be simple, by calling the free() function.

Ответить
@relytheone853
@relytheone853 - 10.06.2023 14:12

I know that a C++ precompiler does this, kinda the same behind the scene. And I wanted to say that what happens to inheritance? How can I make the same?

Ответить
@solonton6341
@solonton6341 - 24.03.2023 22:44

You can also do
struct Person p1 = {&setAge, &getAge};

Ответить
@azaktivalasienergiaendoter814
@azaktivalasienergiaendoter814 - 13.11.2022 22:16

THANK YOU VERY MUCH

Ответить
@WrinkledHound
@WrinkledHound - 07.06.2022 16:59

I haven't checked the latest C or C++ standards but about 15 years ago the only formal difference between a struct and a class is that by default everything within a struct is public while everything within a class is private.

Ответить