How do you implement a class in c?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How do you implement a class in c??

3rd Feb 2019, 10:41 AM
Himanshi Singh
Himanshi Singh - avatar
3 Answers
+ 8
AFAIK, this is impossible in C. The closest thing to a class that you can do is using struct. https://www.sololearn.com/learn/C/2942/?ref=app https://www.sololearn.com/learn/C/2943/?ref=app You can also check this thread: https://www.sololearn.com/discuss/1627377/?ref=app
3rd Feb 2019, 11:28 AM
Lambda_Driver
Lambda_Driver - avatar
+ 2
if you are writing just in C, which is not an object-oriented language per se. It can done. The first versions of C++ and objective C used preprocessors followed by a c compiler, such as gcc, but now most objected oriented programming languages have their owncompilers.
5th Feb 2019, 5:46 AM
Christopher Goodman
Christopher Goodman  - avatar
+ 1
it is not possible in C, the concept of class is introduced in c++ which is extended part of c. instead you can try for structure
4th Feb 2019, 4:39 AM
Aditya Kulkarni
Aditya Kulkarni - avatar