To view parent comment, click here.
To read all comments associated with this story, please click here.
And that objects inherit functions from their parents. For example, if I have a GtkRadioButton I can call GtkButton and GtkWidget methods on it, because they're both parents.
I've not tried getting too crazy with this, but it's generally worked for me so far. I'm guessing it breaks down somewhere, and I'm sure the enforcement of the OO nature is by hand; but yes, you can write OO stuff in c. And Gtk is a very good example.
A hello world program in c would be simply sending a pointer to the first character of the string and the print function prints until it hits . It's not showing any kind of inheritance, data hiding, or anything like that; so it's not object oriented.
I don't know what you're talking about with this "string object" idea. It's just a series of bytes on the program stack...
I have looked at it, and I agree with you, the ideas behind it are object oriented, but it is object oriented by ideom not by language. This gives people not realizing this, too many possibilities to screw it up.
Why not use a language that support these ideas, instead of having people do it manually. The fact that we can write structured programs in assembler doesn't make assembler a good choise for everyday programming tasks, just like using C for object oriented stuff is generally a bad idea. For one thing, it increases the learning curve of the API.
I'm not saying that Eiffel would be a better choise than C, as there are probably to few people who know it.
C is preferable for bindability.
Very few people need to work on a library, as compared to how many will use it.
There are problems like people trying to look at parts of structs they shouldn't (which in gtk is almost everything, but not quite, unfortunately) and they'll have to read header files to find the contents as it's not always documented. But hey, if you can't follow directions you'll use it wrong no matter what language it's written in!





Member since:
2005-06-29
Gtk is highly OO. I suggest you look at it.
Those c machines don't run c++ by magic. Some object things in c are *much* more confusing than say Java (nothing is more confusing than c++).