Sorted by:  

Abstract Classes in C++

As intellectually satisfying as factoring is in C++, it introduces a problem of its own. In an example about bank account classes, specifically the common base class [more…]

C++ Abstract Class Concept

An abstract class in C++ is a class with one or more pure virtual functions. A pure virtual function is a virtual member function that is marked as having no implementation. Most likely it has no implementation [more…]

Why C++ Needs Polymorphism

The capability in C++ of deciding at runtime which of several overloaded member functions to call based on the run-time type is called polymorphism, or [more…]

How Polymorphism Works in C++

As a fence straddler, C++ supports both early and late binding. Any given programming language can support either early or late binding based upon the whims of its developers. Older languages like C tend [more…]

How Does Inheritance Work in C++?

Inheritance in C++ the ability of one class to inherit capabilities or properties from another class. Inheritance is a common concept. You inherit certain properties from the class [more…]

C++ Programming: When Is a Virtual Function Not?

In C++, just because you think that a particular function call is bound late doesn’t mean that it is. If not declared with the same arguments in the subclasses, the member functions are not overridden [more…]

What Is a HAS_A Relationship in C++?

In an example for a C++ program, suppose the class GraduateStudent includes the members of class Studentand Advisor, but in a different way. By defining a data member of class [more…]

How to Use a Subclass in C++

This example C++ program demonstrates the creation and use of two objects, one of class Student and a second of a subclass GraduateStudent. The output of this program is as follows: [more…]

Virtual Considerations in C++

You need to keep in mind a few things when using virtual functions in C++. First, static member functions cannot be declared virtual. Because static member functions are not called with an object, there [more…]

C++: Declaring Static Member Functions

Member functions can be declared static in C++. Static member functions are useful when you want to associate an action to a class, but you don’t need to associate that action with a particular object. [more…]

How to Use Static Members in C++

In C++, you can declare a member to be shared by all objects of a class by declaring that member static. A static data member in C++ is one that has been declared with the [more…]

C++: Uses for Static Data Members

Static data members have umpteen uses in C++, but here are just a few. First, you can use static members to keep count of the number of objects floating about. [more…]

Why You Need Copy Constructors in C++

The constructor is a special function that C++ invokes automatically when an object is created to allow the object to initialize itself. There are two particular variations of the constructor known as [more…]

Why Do You Need Static Members in C++?

By default, data members are allocated on a per-object basis. For example, each person has his or her own name. You can also declare a member to be shared by all objects of a class by declaring that member [more…]

How Address Operators Work in C++

Like the saying goes, “Everyone has to be somewhere.” Every C++ variable is stored somewhere in the computer’s memory. Memory is broken into individual bytes, with each byte carrying its own address numbered [more…]

How to Use Pointer Variables in C++

A pointer variable is a variable that contains an address, usually the address of another variable. This is somewhat analogous to a hotel. When you make your reservation, you may be assigned room 0x100 [more…]

How to Pass Pointers to Functions in C++

One of the uses of pointer variables in C++ is in passing arguments to functions. To understand why this is important, you need to understand how arguments are passed to a function. [more…]

How to Use the Keyword const in C++

A pointer is a variable that “points at” other variables in C++. The keyword const means that a variable cannot be changed once it has been declared and initialized. [more…]

How the Heap Works in C++

The heap is an amorphous block of memory that your C++ program can access as necessary. Learn about why it exists and how to use it.

Just as it is possible to pass a pointer to a function, it is possible [more…]

How to Create a New Code::Blocks Project that Includes a Header

Many C++ newbies want to create the projects they find in books by typing in the code they come across to better see how the process works. However, sometimes just getting the project started can be a [more…]

Attaching to a Running Process Using Code::Blocks

Every time you start a new application, you create one or more processes. A process is simply executable code that is loaded into memory. The CPU reads and executes the instructions to perform the tasks [more…]

Using a Dynamic Array with a Structure

Static arrays are allocated on the stack, which can limit their usability. Dynamic arrays are allocated on the heap, which means they're only limited by the size of memory. Admittedly, you'll find a few [more…]

Working with Configuration Files

Most applications require some level of configuration. The user or administrator selects application options or the application itself detects environmental needs. The kinds of input for configuration [more…]

Using Duplicate Keys with a multimap

A map provides a method for quickly working with lists of data in such a manner that you can access each element easily with a key. Using a map is convenient because you can access the items in a random [more…]

Code Examples for C++ All-in-One For Dummies, 3rd Edition

Click here to download the code example files for C++ All-in-One For Dummies, 3rd Edition. These files contain all the sample code from the book. Use them to work through all the C++ sample applications [more…]


Sign Up for RSS Feeds

Computers & Software
Win $500. Enter Now.

Inside Dummies.com