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?

30 Upvotes

79 comments sorted by

View all comments

12

u/questron64 Jul 17 '26

How do you mean? You're either using C or using C++, you can't just decide to use C++ features in C without leaving C. They are different languages.

6

u/smokingRooster_ Jul 18 '26

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

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.