OOPortal OOPortal


Building Classes in C++   «Prev  Next»
Lesson 4 C++ Expectations
Objective Explore key course features.

C++ Class Features and Expectations

This course begins with general concepts and explanations, and then progresses to examinations of useful ADTs (abstract data types) implemented using the class construct.
C++ feels like a new language because I can express my ideas more clearly and directly in C++11 than I could in C++98. In addition, the resulting programs are better checked by the compiler and run faster. Like other modern languages, C++ is large and there are a large number of libraries needed for effective use. This website aims to give an experienced programmer an idea of what constitutes modern C++. It covers most major language features and the major standard-library components. This website can be referred to over a period of time, but, obviously, there is much more to writing good C++ than can be learned with one course. However, the aim here is not mastery, but to give an overview and to give key examples, and to help a programmer get started.
For mastery, consider the reference book C++ Programming Language, Fourth Edition by Bjarne Stroustrup
The C++ Programming Language
I have added extensions and improvements to make this website reasonably self-contained.
The assumption is that you have programmed before. If not, please consider reading a text website, such as Programming: Principles and Practice Using C++ before continuing here. Even if you have programmed before, the language you used or the applications you wrote may be very different from the style of C++ presented here. As an analogy, think of a short sightseeing tour of a city, such as Copenhagen or New York. In just a few hours, you are given a quick peek at the major attractions, told a few background stories, and usually given some suggestions about what to see next. You do not know the city after such a tour and do not understand all you have seen and heard. You do not know how to navigate the formal and informal rules that govern life in the city.

Preprocessor

The include files that a program uses are merged into the source file by a part of the compiler program known as the preprocessor. The preprocessor also performs some other functions, which are discussed in subsequent paragraphs. The result of the preprocessing is that when the compiler goes to translate the C++ statements into machine instructions, it sees a modified version of the input source file. This can occasionally result in some incomprehensible errors. For example, a missing } in an include file can result in error messages about a subsequent include file that actually has no errors and may even be part of the standard library.

C++ Compiler

The C++ compiler translates the source program (in file sourceFile.cpp) into an intermediate form known as object code. This intermediate form is similar to machine language except that references to external functions and variables are in a format that cannot be processed directly by the compiler but must be resolved by the linker.

Course project

This course concludes with an extended course project that allows you to use many of the skills you have learned. A life simulation game that formed the course project for Introduction to C++, will be expanded.
If you did not take Introduction to C++, you can examine a suggested solution to that course's final project and use it as a basis for the final project in this course.