hi,
i heared it's possible to use oop in C.
does someone can give me a brief introduction of how it is being done?
thanks in advance
Printable View
hi,
i heared it's possible to use oop in C.
does someone can give me a brief introduction of how it is being done?
thanks in advance
May I ask why you want to mimick OOP in C instead of using C++?
Maybe just for fun. :DQuote:
Originally Posted by Marc G
They have a show on Discovery Channel, I think it is called "Lost secrets of the Ancient World" or something like that. In that show a bunch of guys have to build bridges, cranes, ships etc using only ancient materials, technologies and tools. ;) ( not that C is ancient or anything)
try Object oriented Programming in c ul get all the stuff that u need....;)Quote:
Originally Posted by SunCore
n also found This
You should read this paper on OO in ansi C
regards
There is another point: if you by some circumstances need to program in C, it's generally better to use OOP style.
Why?Quote:
Originally Posted by RoboTact
You use lots of structs, construct with Create() functions and destroy with Destroy() functions.
Polymorphism is achieved with pointers to functions.
It is possible to simulate OOP in C but I'm not sure if it is worth it. If the decission to use C and not C++ was correct it means that you do not need an OOP approach and that you are aiming for something else. In that case why use OOP?
This is a more generic question actually: why force OOP on languages not designed for it? ASM, Visual Basic etc are fine languages for the tasks they were designed to. OOP is not among those tasks.
I don't get exactly why anyone would choose C nowadays.
I think a hardcore C# programmer asks himself the very same question. :)Quote:
Originally Posted by NMTop40
It doesn't. There may be external causes forcing to use C.Quote:
Originally Posted by PadexArt
Then the decission to use C is not correct. :)Quote:
Originally Posted by RoboTact
There may be singleton decision space.Quote:
Originally Posted by PadexArt
Ouch. :DQuote:
Originally Posted by RoboTact