RP> What is the difference between C and C++
That would take a while to explain!
In short, though, C++ has a few new keywords, such as new,
delete, and class. It supports function and operator
overloading. It supports data object conversions. It
supports the three principles of OOD, which are
encapsulation, inheritance, and polymorphism. Encapsulation
is keeping your data objects separate from the environment
in which they are created. All the code used to manipulate
those objects are part of the data object itself. Creating a
String automatically gives you the code to manipulate that
string, but you cannot actually manipulate that string,
EXCEPT via that code. It is safe from mishandling because it
is encapsulated within the class within which resides its
code object. You may derive a class from any given class,
and it will inherit all or part of the data and code objects
which belong to that class, unless you override those data
or code objects in your derived class, which is known as
polymorphism. You get everything if you want it, but you
don't have to take anything you don't want.
Typical C code will contain many calls to library functions
to carry out the application objectives. C++ code will
seldom access library functions openly. All of that is done
within the support code for the data objects. A class which
has been constructed to handle a certain type of data will
handle it just as well in any application into which it is
included, without the programmer who includes it having the
ability to mess it up, whereas users of C libraries will
invariably, ( at least in my case :), find some way of
messing up common usage of C functions. If you want to use
C++, you should start by learning how classes are defined,
what they are, and how they work. They are the heart of OOP.
> ] Presently orbiting Mars in a Supertramp album...............
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
|