Search results

  1. Template Specialization

    In many cases when working with templates, you'll write one generic version for all possible data types and leave it at that--every vector may be implemented in exactly the same way. The idea of template specialization is to override the default template implementation to handle a particular...
  2. Templated Functions

    C++ templates can be used both for classes and for functions in C++. Templated functions are actually a bit easier to use than templated classes, as the compiler can often deduce the desired type from the function's argument list. The syntax for declaring a templated function is similar to...
  3. Templates and Template Classes in C++

    What's better than having several classes that do the same thing to different datatypes? One class that lets you choose which datatype it acts on. Templates are a way of making your classes more abstract by letting you define the behavior of the class without actually knowing what datatype will...
  4. Formatting Cout Output in C++ using iomanip

    Creating cleanly formatted output is a common programming requirement--it improves your user interface and makes it easier to read any debugging messages that you might print to the screen. In C, formatted output works via the printf statement, but in C++, you can create nicely formatted output...
  5. Enumerated Types - enums

    Sometimes as programmers we want to express the idea that a variable will be used for a specific purpose and should only be able to have a small number of values--for instance, a variable that stores the current direction of the wind might only need to store values corresponding to north, south...
  6. Do great relationships start out as friendships?

    i really dont think so but i know some of my friends that has started as friendships and ended in relationships :S
  7. Do great relationships start out as friendships?

    i really dont think so but i know some of my friends that has started as friendships and ended in relationships :S
  8. Hii everyone

    Hi my name is Florian Aliaga i come from The Republic of Kosovo im 17 years old.My hoby is Basketball .
  9. Class Design in C++

    Understanding Interfaces When you're designing a class in C++, the first thing you should decide is the public interface for the class. The public interface determines how your class will be used by other programmers (or you), and once designed and implemented it should generally stay pretty...
  10. Understanding Initialization Lists in C++

    Understanding the Start of an Object's Lifetime In C++, whenever an object of a class is created, its constructor is called. But that's not all--its parent class constructor is called, as are the constructors for all objects that belong to the class. By default, the constructors invoked are the...
  11. Lesson 20: Inheritance - Syntax

    Before beginning this lesson, you should have an understanding of the idea of inheritance. If you do not, please read lesson 19. This lesson will consist of an overview of the syntax of inheritance, the use of the keywords public, private, and protected, and then an example program following to...
  12. Lesson 19: Inheritance in C++

    The ability to use the object-oriented programming is an important feature of C++. Lesson 12: classes in C++ introduced the idea of the class; if you have not read it and do not know the basic details of classes, you should read it before continuing this tutorial. Inheritance is an important...
  13. Binary Trees in C++: Part 1

    The binary tree is a fundamental data structure used in computer science. The binary tree is a useful data structure for rapidly storing sorted data and rapidly retrieving stored data. A binary tree is composed of parent nodes, or leaves, each of which stores data and also links to up to two...
  14. Binary Trees in C++: Part 1

    The binary tree is a fundamental data structure used in computer science. The binary tree is a useful data structure for rapidly storing sorted data and rapidly retrieving stored data. A binary tree is composed of parent nodes, or leaves, each of which stores data and also links to up to two...
  15. Lesson 17: Functions with Variable Argument Lists in C and C++ using va_list

    Perhaps you would like to have a function that will accept any number of values and then return the average. You don't know how many arguments will be passed in to the function. One way you could make the function would be to accept a pointer to an array. Another way would be to write a function...
  16. Lesson 16: Recursion in C and C++

    Recursion is a programming technique that allows the programmer to express operations in terms of themselves. In C++, this takes the form of a function that calls itself. A useful way to think of recursive functions is to imagine them as a process being performed where one of the instructions is...
  17. Lesson 15: Singly linked lists

    Linked lists are a way to store data with structures so that the programmer can automatically create a new place to store data whenever necessary. Specifically, the programmer writes a struct or class definition that contains variables holding information about something, and then has a pointer...
  18. Lesson 14: Accepting command line arguments in C++ using argc and argv

    In C++ it is possible to accept command line arguments. Command-line arguments are given after the name of a program in command-line operating systems like DOS or Linux, and are passed in to the program from the operating system. To use command line arguments in your program, you must first...
  19. Lesson 13: Inline Functions in C++

    Although you've already learned about basic functions in c++, there is more: the inline function. Inline functions are not always important, but it is good to understand them. The basic idea is to save time at a cost in space. Inline functions are a lot like a placeholder. Once you define an...
  20. Lesson 12: Introduction to Classes in C++

    C++ is a bunch of small additions to C, with a few major additions. One major addition is the object-oriented approach (the other addition is support for generic programming, which we'll cover later). As the name object-oriented programming suggests, this approach deals with objects. Of course...
Back
Top