Newbie: The C / C++ Issue

Chris Pressey cpressey at catseye.mine.nu
Thu Nov 13 11:39:54 PST 2003


On Thu, 13 Nov 2003 11:01:54 -0800
"abowhill" <abowhill at blarg.net> wrote:

> > Am I missing something here?  When does C have OO capability?
> > Structs don't count.  What about inheritance and polymorphism?
> 
> >>That's in the implementation AND application.  Just because you CAN
> >>access part of a lowly struct, doesn't mean you have to.  It's
> >object>oriented if you OBSERVE the restricted accesses defined by OO.
> >>Whether or not they're there is completely irrelevant.  Of course C
> >>has OO capability, it just doesn't have its restrictions :)
> 
> The idea that C can be used to do object-oriented programming is 
> a myth. The C language is not object-oriented or even object-based.
> The big reason C++ is object-oriented is due to dynamic binding.

I don't think I buy that.  With that reasoning, couldn't you say that
any program in any language that does any sort of dynamic binding (for
example, opening a .so file) "is object-oriented"?

The way I see it is that object-orientation is a methodology, and
languages aren't methodologies, so it's absurd to say that some language
"is" or "isn't" object-oriented.  (I mean, we all know that the Bourne
shell "is object-oriented,"[1] right? :)  The best you can do is to
describe the degree to which some language supports or enforces
object-oriented programming.  Incidental to that, C++ provides many
abstractions which support object-oriented programming, while not
enforcing them in any way.

But this is getting far off topic for this list; the bare facts remain:

- much of FreeBSD (kernel, userland) is written in C
- many FreeBSD ports are written in C++

So, as stated several times now, it really depends on what you want to
work on.

-Chris

[1]
http://www.usenix.org/publications/library/proceedings/bos94/haemer.html


More information about the freebsd-questions mailing list