r/C_Programming • • Jul 17 '26

C with classes

I'm curious to know: who uses some C++ features when coding in C? And what feature(s) are you using?

29 Upvotes

79 comments sorted by

View all comments

Show parent comment

7

u/smokingRooster_ Jul 18 '26

I disagree, you can write object oriented C, it’s not a feature exclusive to C++.

4

u/cheesengrits69 Jul 18 '26

Hell yeah dude, you're getting downvoted because this sub is full of haters. Implement that vmt in C by hand, include multiple inheritance functionality just to add in some more chaos, the world is yours

6

u/[deleted] Jul 18 '26

[removed] — view removed comment

3

u/smokingRooster_ Jul 18 '26

How so? OOP can be implemented in C, it just doesn’t come built into the language like C++

0

u/[deleted] Jul 18 '26

[deleted] — view deleted comment

2

u/smokingRooster_ Jul 18 '26

If a feature doesn’t exist in a language by default but you can implement it yourself then what’s the difference?

0

u/[deleted] Jul 18 '26

[deleted] — view deleted comment

0

u/smokingRooster_ Jul 18 '26

OP asked who uses C++ features in C. OOP is a C++ feature and I use it when coding in C… so I’m struggling to see how that doesn’t count. OP never specified if the feature should be native to C or whether it is emulated.

2

u/Coding-Kitten Jul 18 '26

The concept of writing object oriented code isn't a C++ feature. Using C++ syntax that the C++ compiler accepts but the C compiler rejects is using C++ features, & which, by definition, you do need to pick C++ to do so in as it's invalid C syntax.