©1994-2003 Kevin Boone
Home     Section index     K-Zone home C++ tutorial (under construction)

Site search

Glossary
Confused by computer jargon? Look it up!

Shameless plug


Now available!

Articles
- Ten-minute guide to setting up a WAP site

- Talk like your boss: new developments in managerese

More...

Development
File handling in the Linux kernel

Java development for the Sony-Ericsson P800

SunONE Application Server 7 FAQ

More...

Linux
Using Linux with the Treo 600

- Linux on the Tecra M1

- Some notes on openzaurus

More...

Download
Java stuff

Linux stuff

More...

(Please read the download policy)

Home automation
The X10 system

Linux TW723 driver

More...

The K-Zone
K-Zone computing

K-Zone law

K-Zone education and science

K-Zone motorcycles

K-Zone DIY

K-Zone railways

K-Zone martial arts

About the author

K-Zone home page

 
introduction
contents
general info
C++ tutorial: about the tutorial


C and C++ are high-level languages
There are various ways of understanding what 'high-level' language means. First, the language uses statements and instructions that are very different to those understood directly by the computer. Fundamentally, the computer understands numbers, and nothing else. Any other type of information we want to process has to be coded in terms of numbers. On the whole, people don't like to do this, and it is rather slow and prone to error. A high-level programming language uses instructions that are somewhat similar to natural language, i.e., it is based on 'words' like 'while' and 'if', and uses symbols with which we are familiar, like '+' and '='.

Secondly, high-level means 'abstract'. Many of the statements that the programmer will write bear little relation to what the hardware of the computer actually does. Fore example, when we use the 'cout' mechansim to display text on the screen, the computer may actually execute a million or more very simple instructions, but thankfully the C++ progammer need not be aware of this. In other words, the language provides an abstraction mechanism, a way to hide detail and concentrate on the 'big picture'.

C and C++ are industry-standard
It is difficult to estimate the number of people and organizations actively using C/C++ in their business, but those that do are very much in the majority. Use of C/C++ undoubtedly exceeds the use of all other programming languages put together. It is by no means certain that this situation will persist; many academic organizations have abandonned C++ in favour of Java, as have some commercial ones. The rise of 'visual' programming languages like Microsoft's 'Visual BASIC' has also had an impact on the use of C and C++. This should not be a deterrent to anyone who wants to learn C++. On the contrary, a good understanding of C++ will make understanding Java a simple exercise, and will render the use of languages like Visual BASIC unnecessary. With practise, you will be able to produce better programs more quickly using C++ than any other system.

C++ is an extension to C
C++ implements all of C's features, and adds some significant enhancements. Most of these enhancements are outside the scope of this course, but we will use them when they are simpler or more logical than the equivalent C features. The most profound enhancement of C++ over C is the addition of 'object oriented' features. Object-orientation is a technique for handling the complexity of a large program by dividing it into self-contained components (called classes) that often model features in the real world. Object orientation is one of the most important advances in computer science in recent decades, and requires a complete course to do it justice.

Incidentally, the name 'C++' came about because '++' is the C notation for 'increment' or 'advance'. 'x++' means 'add one to x' or 'move to the next item after x', depending on what 'x' is. The idea is to give the impression that C++ is an advance on C, but is not totally different. This is what passes for humour among computer programmers.

C++ is the basis for Java
The Java language uses a structure that is almost identical to C++. In fact, the Java designers considered C++ to be too complicated, and Java lacks many of the features of C++. The Java people make a good case for this, but at the end of the day it is a matter of personal taste whether you prefer the Java or the C++ ways of doing things. In any event, if you know C++ you will have no difficulty using Java.

The rudiments of C/C++ can be mastered in a few hours
The subtleties and technicalities, however, may take several years to get to grips with. Happily, excellent programs can be constructed without the use of these sophisticated features, and if you carry on using C++ professionally you can pick them up 'on the job'.

C/C++ is designed to be simple; the language uses only a few simple instructions and operations that can be combined in various ways to make more complex things happen.

The best way to learn is by doing
You can only learn a certain amount from lectures, textbooks, and tutorials like this one. The best way to get to grips with a programming language is by using it. In this course I will be suggesting various exercises for you to try; some are very simple, but later ones are quite challenging. You should have a go at these exercises: if they seem difficult you should persevere, and not give up. Your stubbornness will be rewarded!