what is c++, c, ansi c etc...

rick at tmiuv0.uucp rick at tmiuv0.uucp
Thu Apr 12 21:48:34 AEST 1990


In article <28742 at cup.portal.com>, Chewbacca at cup.portal.com (Paul Frederick Snively) writes:
> brnstnd at stealth.acf.nyu.edu writes:
> 
>>> Also what is object oriented programming?
>>
>>The latest name that young urban computer science types have applied to the
>>old idea of adding another level of indirection to function calls.
> 
> At best this definition is grossly naive and misinformed; at worst it is just
> plain wrong.
> 
> There doesn't seem to be a "definitive" description of the fundamentals of
> object-oriented programming, so the best that I can do is to provide you with
> a list of the things that come to my mind when I happen to think of object-
> oriented programming:
> 
 [list of items deleted]

The best "thumbnail" sketch of OOPS (Object Oriented Programming Systems) I
can offer is that your programming style (well, actually your problem solving
style) changes.  Currently, C causes you to think "procedure-wise".  In other
words, you think about _how_ to solve the problem, writing a list of procedures
that will accomplish the task.  This involves how to manipulate the data
objects you're playing with at each step of the way.

In C++, the OOPS version of C, you think "solution-wise".  You simply write
code which treats your data objects as though they were standard C variable
types.  You don't have to worry about "Gee, now, if I want to add these two
structures, I have to add each member of one to the corresponding member of
the other" and write the code to do that each time.  Instead, you simply say
"c = a + b", where a, b, and c are the structures you are playing with.  Later
on, you write a "data abstraction" which defines what the structures look like,
a set of functions and operators which perform the operations on the data, and
which parts of the structures are visible to the outside world.  Once that's
done, your code is much more readable, since you're not writing "c.mem1 =
a.mem1 + b.mem1;", just "c = a + b".

That's simplifying it a bit, but the general idea is correct.

C++ can really make some nasty and complex code a heck of a lot easier to deal
with.

-- 
  .-------------------------------------------------------------------------.
 / [- O] Rick Stevens (All opinions are mine. Everyone ignores them anyway.) \
|    ?   +--------------------------------------------------------------------|
|    V   | uunet!zardoz!tmiuv0!rick             (<-- Work (ugh!))             |
|--------+ uunet!zardoz!xyclone!sysop           (<-- Home Unix (better!))     |
|  uunet!perigrine!ccicpg!conexch!amoeba2!rps2  (<-- Home Amiga (Best!!)      |
 \ 75006.1355 at compuserve.com (CIS: 75006,1355)  (<-- CI$)                    /
  `-------------------------------------------------------------------------'
"I bought some instant water, but didn't know what to add."
                                 - Steven Wright



More information about the Comp.lang.c mailing list