Level of OOPS

A

ArWeGod

Vivek said:
To what level can we attain object oriententation with the C language?

Well, you can write a C++ compiler in C. ;-)

But seriously, like the old song said; "Anything C++ can do, C can do
better..."

.... You just have to do it the old fashioned way, by creating structures
with pointers to linked-lists of other structures, and stuff like that.
Kinda like the concept of an Interface in COM objects.

It's hard enough to do that they invented a new "generation" of languages to
handle it all, so why not use those? There's C++, Java, D, etc.
 
B

Bruno Desthuilliers

Vivek said:
To what level can we attain object oriententation with the C language?

You may want to have a look on :
- the Gtk+ framework (http://www.gtk.org)
- Laurent Deniau's OOPC
(http://ldeniau.home.cern.ch/ldeniau/html/oopc/oopc.html)


The first one may not support all and every OO concept, but has proven
to be fairly usable - and used : Gnome is based on Gtk+.

The second is more complex, and seems to support more of the OO
concepts. I don't know how much it is used in production code, but if I
understand well, it has been developped by Laurent Deniau to use OO on
emmbedded platforms not supporting C++.

Google (+"C" + "object oriented" -Objective) also points to :
http://sunsite.nstu.nsk.su/sunworldonline/swol-10-1995/swol-10-ooc.html
http://www.accu.org/acornsig/public/articles/oop_c.html (not really
interesting IMHO - mostly a confusion between ADT and OO).
http://www.ticalc.org/archives/files/fileinfo/251/25159.html
http://www.methodpark.com/produkte_oo2c_en_body.html
http://www.linux-mag.com/2000-10/compile_01.html
http://www.planetpdf.com/binthing~WebPageID,620.htm
etc...

Bruno
 
M

Malcolm

Vivek said:
To what level can we attain object oriententation with the C language?
Data encapsulation is easy and is done all the time.
All you do is define a structure, a function that creates it (the
constructor) and a function to destroy it (the destructor), and a few
functions that do interesting things.

What is very messy to do in C is inheritance and polymorphism. It is
possible, OO is a programming technique rather than a language, but if your
design calls for hierachies of objects then you are better off with a
higher-level language that supports these structures directly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top