The Switch Statement in C++

Similar Posts

  • Overloading a Function

    Overloading a function means that you can create different functions with the same name, as long as their signatures are different. That means that the parameter list must be of a different number and/or data types from one to another. Overloading functions can make reading code much clearer/easier. This way functions that perform the same…

  • Pointer Basics in C++

    A Pointer variable, just called a pointer, holds the memory address of data that is stored. Through the pointer, you can read the address, and thus indirectly access the value of the variable. To access a value, you use the dereference operators (*) to get the value stored at that memory address. To store a…

  • Derived Classes

    You can extend almost any class you want. So once you’ve defined a base class, you just need to know enough about it, and how you want to derive from it. Considering our GenericGeometric class from before, let’s look at deriving a Circle class from it. In our header file we will have: Notice two…

  • A Sample C++ Program

    Let’s look at a simple program and work through it step by step. #include #include statements are at the top of the file, and let you include any libraries you might need. iostream, in our example is used to help process input and output. You might think this is standard, but if you are building…

  • Destructors in C++

    We’ve looked at Constructors in C++ to create an object, and building an object with new. However, what happens when we no longer need that object? That’s where a destructor is called. It is built into all objects, and if you don’t define one, a default one will be called for you. The destructor’s job…