Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Introduction to the C plus plus Programming Language

WHAT IS C++?

C++ is an object oriented, compiled, low-level, reasonably portable programming language. It's based on C, and it maintains C's syntax. If you're going to learn C++, you'll do very well to have a grounding in C first, or to take a course that covers the relevant C syntax as well as the C++ extensions.

OBJECT ORIENTED

First and foremost, you'll find the headlines telling you that C++ is Object Oriented.

When you write your first program, you'll write a few lines of code to perform a task and it'll work well for you. As you develop onwards to more complex programs, you'll find that you're repeating sections of code (through cut and paste) and that it's a much better idea to name these sections or blocks of code so that you can simply call them up again by name. Fairly soon, you'll find yourself moving these blocks of code out into separate source files so that you can use the same logic elements from one program to the next.

Name blocks of code in this way give you:

- Code re-use to cut down on development and maintenance time.

- Consistency across applications that make your code more
  user-friendly and less liable to show up obscure bugs.

The approach of having named blocks of code right across your suite of applications, with each code block performing a specific single task, is known as structured programming. It's streets ahead of single-block code. HOWEVER:

- As your code grows further, you can end up with conflicts
  between blocks of code that happen to have been given the
  same name.

- You would prefer a system where you're encouraged to group
  all the bits of code that deal with one data type in one place.
  That way, you'll know you have just one area to update and
  maintain as your data formats or user requirements change.

- You would like a mechanism where you can easily say that one
  type of data and its blocks of code are based on another, and
  just describe the changes in a file.

- You would like to be able to forget what goes on at the low
  level of the code when you're writing at a higher level, and
  just know what you need to put in, what the effects are and
  what you get out.

In turning your design inside out from a structured program by thinking of the data aspects first rather than the code aspects, it turns out you can have all these benefits and more. At the expense of a few surprises early on, as your project grows in size, it turns out to be very extensible under object orientation.

COMPILED

C++ is a compiled language. You write a source code file using any editor that you find convenient and that can produce a plain text file output, and you save that file.

You run the source code file through a compiler, and that produces an object file which is a snippet of binary code suitable for your target computer architecture and operating system.

The object file itself is not a complete application. You then need to use a loader/ linker/taskbuilder to roll it in with all the other pieces of code, both yours and standard pieces from the library, before you come up with the final executable file.

LOW LEVEL

C++ is often described as a low-level language in that you have the full control as you code over how memory is allocated, and you can program down to a bit/byte/ register level if you wish. For some applications where performance is paramount, this is exactly what you want. For other applications where you're rushing to develop the code for use just a few times, C++ won't be the language for you unless you're reusing lots of existing code, and/or you're already very familiar with C++ but you're not skilled in other languages such as VB, Python or Perl.

PORTABILITY

C++ executable programs are not portable between operating systems/CPU types. And yet I said earlier on that it's "reasonably portable", didn't I?

The portability is at a source code level. It's possible to recompile the same source code under a different compiler, to generate object files and ultimately an executable file for different operating system and hardware combinations.

However, even at the source code level libraries do vary and you need to be careful as you develop code. You'll find that there's a great deal of open source code devel- oped in C++, and that the first stage of installing it onto a target machine is to run a configuration script that looks around the machine and finds out all the compiler details, library details, and more, that it needs to get the configuration right.
 
So, C++ is portable. But it is not just a case of transferring source and running (as it would be with Perl or Python), nor is it simply a case of having the right virtual machine at hand to handle object files (as it would be with Java).

BASED ON C

The C language has been around for many years, and is the industry standard in which many operating systems have been developed. C is also the language in which many other languages are written. There days, however, actually writing in C has become something of a niche as most applications are now written using the superb tool sets that earlier C authors have been able to provide for us, anything from languages to servers to spread sheets to word processors with macro languages.

Being based on C, and maintaining compatibility with it, has made some of the elements of C++ quite complex. Decisions to include multiple inheritance and certain other features in C++ haven't helped to make it quick and easy to learn, and a number of other languages such as C# and Java have been developed by Microsoft and Sun respectively which take much of the intent of C++ but break the C compatibility, simplify, and provide languages which are a little more mainstream and much faster to develop.




See also Training Course - C plus plus Programming

Please note that articles in this section of our web site were current and correct to the best of our ability when published, but by the nature of our business may go out of date quite quickly. The quoting of a price, contract term or any other information in this area of our website is NOT an offer to supply now on those terms - please check back via our main web site

Related Material

C and C based languages - C++ - General
  [2370] - ()
  [2504] - ()
  [2536] - ()
  [2577] - ()
  [2763] - ()
  [2851] - ()
  [3052] - ()
  [3067] - ()
  [3129] - ()
  [3155] - ()
  [3250] - ()
  [3587] - ()
  [3809] - ()
  [4335] - ()
  [4355] - ()

C and C based languages - Introduction to C++
  [317] - ()
  [318] - ()
  [336] - ()
  [928] - ()
  [2004] - ()
  [2169] - ()
  [2845] - ()
  [3052] - ()
  [3053] - ()
  [3069] - ()
  [3250] - ()
  [4466] - ()
  [4561] - ()
  [4562] - ()

resource index - Linux
Solutions centre home page

You'll find shorter technical items at The Horse's Mouth and delegate's questions answered at the Opentalk forum.

At Well House Consultants, we provide training courses on subjects such as Ruby, Lua, Perl, Python, Linux, C, C++, Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer) many questions, and answers to those which are of general interest are published in this area of our site.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/solutions/linux-in ... guage.html • PAGE BUILT: Wed Mar 28 07:47:11 2012 • BUILD SYSTEM: wizard