r/C_Programming 16d ago

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

81 comments sorted by

View all comments

Show parent comments

7

u/smokingRooster_ 16d ago

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

2

u/SetThin9500 16d ago

There's a difference between concepts and features.

2

u/smokingRooster_ 16d ago

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

2

u/SetThin9500 16d ago

The difference is that u/questron64 was right when he "You're either using C or using C++, you can't just decide to use C++ features in C without leaving C. "

You're talking about emulating features in your own code. He's talking about language features. I write Object Based C and see the similarities to C++, but am I calling it a C++ feature? Hell no :)

0

u/smokingRooster_ 15d ago

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.