From: Michael Neumann Date: 2001-07-24T05:11:36+09:00 Subject: [ruby-talk:18376] Re: Ruby as opposed to Python? On Tue, Jul 24, 2001 at 04:07:19AM +0900, MikkelFJ wrote: > > "Michael Neumann" wrote in message > news:esU67.13526$1V1.966598@e420r-atl2.usenetserver.com... > > > C and C++ are two different languages! C++ is not a newer version of C. > > Definitely not, but it is interesting to notice how close you can get to OO > in pure C: > > You might disagree, but I'd say that one of the most important aspects of OO > is the ability to relate behaviour to data. Abstract datatypes is one important aspect of OO. This is also possible with object based languages, that do not have inheritance (e.g. Ada). > In C you can store function pointers inside structures, thus essentially > pass behaviour around. You can not enherit structures, but you can point > from one structure to another to another. Syntactically this is not always > elegant, but conceptually C is very powerful if you want it to be. It comes > down to programming style. > In fact OO is something you implement, not something you find in a language. > Some languages may help you in the process. This is the point. Some languages make it easy to use OO (Ruby) other's make it more hard (e.g. Perl, at least for me :). Indeed the first C++ (or C with classes) was a C compiler with macros. So you can program in C in a OO like fashion, but it's hard and you'll most often don't do it. And if it's really hard to do OO, is this language a "real" OO language? B. Stroustrup would say NO (he said so in his book, IIRC). Regards, Michael -- Michael Neumann *** eMail uu9r@rz.uni-karlsruhe.de