We hope that you enjoyed our previous tutorial on C++ overloading. Today we take another look at operator overloading in the C++ programming language.
Unary and binary operator overloading
There are two types of operator overloading: More »
Posted in C++ Tutorials |
In the C++ programming language overloading is used for performing more than one task using the same function or operator. For overloading of the functions we create two or more definitions of one function name.
Take a look at an example: More »
Posted in C++ Tutorials |
Namespaces are used in the C++ programming language to create a separate region for a group of variables, functions and classes etc. Namespaces are needed because there can be many functions, variables for classes in one program and they can conflict with the existing names of variables, functions and classes. C++ uses namespace to avoid the conflicts.
The concept can be depicted using the following diagram: More »
Posted in C++ Tutorials |
In the first C++ programming tutorial on file IO we looked at the theory behind file IO.
In this second C++ programming tutorial on file IO we will look at some examples. More »
Posted in C++ Tutorials |
This C++ programming language tutorial will be in two parts. The first (this one) will cover the theory behind IO and in the second tutorial we will look at some examples. More »
Posted in C++ Tutorials |
In the last C++ tutorial we looked at the basic concept of classes. In this C++ programming tutorial we take another look at classes.
Constructor and Destructor
Classes can have complicated internal structures, so object initialization and clean-up of a class is much more complicated then for any other data structures. Constructors and destructors are special member functions of classes that are used to construct and destroy class objects. The construction can be for example: initialization for objects or memory allocation. The destruction may involve de-allocation of memory or other clean-up for objects. More »
Posted in C++ Tutorials |
In this C++ programming tutorial we take a look at classes. A class is a mechanism for creating user-defined data types. It is similar to the C language structure data type.
A class can not only hold data variables, but can also hold functions. These variables and functions are members of a class. The variables are called data members and functions are called member functions. More »
Posted in C++ Tutorials |
Structures are used to group together different data elements (types of variables) under the same name. These data elements, known as members, can have different types and different lengths.
Take look at the syntax of a structure: More »
Posted in C++ Tutorials |
In this C++ programming tutorial we will take a look at dynamic memory. Until now the use of memory was determined by the size of the variable we declared. With the use of dynamic memory we can ask for a piece of memory at runtime. In C++ we can use the operators new and delete to get memory and release the memory.
new and new[] operators
With the operator new we can request a piece of memory. A data type must follow the new operator. It is also possible to request more than one element by using brackets []. The result of a new operation is a pointer to the beginning of the memory block (if the request is accepted). More »
Posted in C++ Tutorials |
In this tutorial we take a look at pointers. For most people it will take some time to fully understand pointers.
So you have to be patient and try to make some little programs on your own. Once you master the use of pointers, you will use them everywhere. So get ready this is a long one!
Pointers basics
To better understand pointers, it sometimes helps to compare a “normal variable” with a pointer.
When a “normal variable” is declared, memory is claimed for that variable. Let’s say you declare an integer variable MYVAR. Four bytes of memory is set aside for that variable. The location in memory is known by the name MYVAR. At the machine level that location has a memory address.
A pointer differs in the way that a pointer is a variable that points to another variable. A pointer holds the memory address of that variable. That variable contains a value. Pointers are also called address variables because they contain the addresses of other variables. More »
Posted in C++ Tutorials |