Category: C++

Dynamic Allocation in C++

C++ provides allocation and deallocation functions ‘new’ and ‘delete’ similar to the malloc() and free() function in C. The main advantage of dynamic allocation is...

C++ References

A reference is essentially an implicit pointer that acts as another name for an object. One important use for a reference is to allow you...

Arrays, Pointers and References in C++

C++ supports implementation of array of objects. Below is a simple implementation of array of objects – Note that we polymorphic constructors that acts upon...

Static Class Members in C++

Static data members are used when only one copy of the variable exists and all the objects of that class share that variable. It is...

Inline Functions in C++

Inline functions are small functions defined with the inline keyword. The advantage of using inline functions are – They do not involve the usual stack...

Friend Classes and Functions in C++

When a function is declared as friend, it is not a member of any class. But it could access the private and protected parts of...

C++ Classes and Structures

Structure is similar to Class except for the fact that in structure declaration, all the members are public otherwise specified as private. For example –...

C++ Keywords

C++ provides a wide range of Keywords and much extensive than C programming offers. Below are the commonly used Keywords (reserved). alignas Used to precisely...

Unions and Classes in C++

C++ also supports unions as in C. They are functionally similar to that of a class but has the following limitations: All members are public...

Constructors & Destructors in C++

Constructor and Destructor functions are used in a class so as to automatically perform certain operations when an object of that class type is created...

Inheritance in C++

Inheritance is the property of representing a base class and its derived classes as a hierarchy of classes with the most general functions of the...

Operator Overloading in C++

C++ provides options to overload an operator with more than one function. For eg: C++ overloads the operators << and >> with functions of performing...

Function Overloading in C++

The principle of function overloading helps to implement polymorphism in C++ in which two or more functions share the same name (overloaded functions) and perform...

Classes and Objects in C++

Classes are logical abstractions while Objects are instances of the classes that physical existence in the memory. Syntax for class declaration – We could use...