Kick back and get started at your own pace.

Skip to Content


C++ was developed by Bjarne Stroustrup in 1979. It is a multi-paradigm, weakly typed, general-purpose programming language. C++ does add in facilities for stronger typing than C. C++ has grown in popularity over the years, and is used in about as many environments as C [Stroustrup].

Hello, world!

C++ provides a richer set of facilities for performing tasks than C. Here, the left-shift operator is overloaded to write data to an output stream.


  1. #include <iostream>
  3. int main()
  4. {
  5. std::cout << "Hello, world!\n";
  6. return 0;
  7. }


Stroustrup maxin' and relaxin'

And on the seventh day, Stroustrup finished the work that he had done, and he rested on the seventh day from all the work he had done.

When Stroustrup first began development on what would become C++ in 1979, it was initially known as "C with Classes." It was developed internally at AT&T Bell Labs [Stroustrup, FAQ].

Stroustrup intended to write efficient systems code in the styles encouraged by Simula67 [Stroustrup]. As C was a solid base from which to start, he added the facilities for stronger type checking, data abstraction features, and object-oriented design to the language.


Though C and C++ share a large subset, the two are different languages. C++ is at its best when you utilize the power the language affords, rather than as C with, well, classes.

Stroustrup used his Ph.D. experience to formulate a set of guidelines to aid in the design and "spirit" of the C++ language as it grew [Stroustrup, 3].

Type System

Stroustrup intended to make the typing system stronger in C++. This means the compiler is able to catch more errors as it parses the code. However, in order to meet the needs of systems programmers, there still exists the facilities for explicit type conversions, or casts.

C++ offers a template system to build more reusable interfaces. It allows the programmer to parameterize types.

Suppose we need to construct an interface for an array class. Ideally, we want to allow the array to contain data of any arbitrary type; the abstract idea of an array has the same interface, regardless of what's inside it. The following shows how we might declare an array class.

C++ Template Example

  1. template<typename T>
  2. class Array {
  3. // these are internal data fields that represent our array data
  4. T* data;
  5. size_t size_;
  7. // private functions to handle memory allocation
  8. void alloc(size_t size);
  9. void dealloc();
  11. // this is the start of the public interface of the class, or the part
  12. // that other programmers will use to control the behavior of an
  13. // "Array" object
  14. public:
  15. // These are constructors; they're called as an object is created.
  16. // They're responsible for establishing reasonable default values
  17. // for data fields, allocating memory, etc.
  18. Array();
  19. Array(const T* data, size_t len);
  21. // we have an accessor method here to allow other programmers to
  22. // access data
  23. size_t length() const;
  25. // C++ allows creating custom behavior for certain operators.
  26. // Here, we allow code like ``some_array[index]'' to work
  27. // intuitively.
  28. T& operator[] (size_t i);
  29. };

Good for Beginners?

The C++ programming language is a general-purpose programming language, and you will generally find implementations anywhere you go. It has the benefit of including many convenient libraries and algorithms within the standard library, so it can be easier to get started when you don't have to manually do bookkeeping for dynamically allocated memory.

If learning object-oriented design is either a requirement for you, or something that you just find interesting, C++ provides the facilities to write code in that paradigm, as well as others.

The C++ programming language also has similar learning requirements to C, in that you should have a good idea about how to use the tools involved in building the programs on your system. Also like C, it's a good idea to keep in mind that the C++ language is separate from the implementations of it.


  1. ^ - Stroustrup, Bjarne. Bjarne Stroustrup FAQ. When was C++ Invented? Accessed: 3 Oct 2014.
  2. ^ - Stroustrup, Bjarne. Evolving a Language in and for the Real World: C++ 1991-2006. Accessed: 3 Oct 2014.
000webhost logo