[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: object-oriented C programming



Jason Gunthorpe <jgg@debian.org> wrote:
> 
> I will admit being rather alarmed that someone would pass this off as
> better than C++, I'm not even confident OO is a proper term to describe
> it..

OO design doesn't require an OO language. An OO language makes it easier,
and can enforce OO to varying degrees, but the main ingredient is
discipline.

Data encapsulation and providing methods to manipulate that data makes a
design OO, even if it doesn't have inheritence (which you can fake in C
with a "isa" member on your structs, but it's messy) or polymorphism.

And even though C++ provides language support for data encapsulation and
hiding, inheritance and polymorphism, I wouldn't submit it as a good example
of an OO language. It provides all the same shortcomings of C (it's just a
superset of C to begin with, poor start), it makes private members
well-known (and hence not-so-private), etc. I won't go any further, better
people than I have already done so. ;)
-- 
Sam Couter          |   Internet Engineer   |   http://www.topic.com.au/
sam@topic.com.au    |   tSA Consulting      |
OpenPGP key available on key servers
OpenPGP fingerprint:  A46B 9BB5 3148 7BEA 1F05  5BD5 8530 03AE DE89 C75C

Attachment: pgpHz9TsROzEk.pgp
Description: PGP signature


Reply to: