Category: C++

C++

destructors in c++

destructors in c++

A destructor is another special kind of class member function that is executed when an object of that class is destroyed. They are the counterpart to constructors. When a variable goes out of scope,...

copy constructor

copy constructor

A copy constructor is a special constructor in the C++ programming language for creating a new object as a copy of an existing object. The first argument of such a constructor is a reference...

friend functions c++

friend functions c++

In object-oriented programming, a friend function that is a “friend” of a given class is allowed access to private and protected data in that class that it would not normally be able to access...

friend classes in c++

friend classes in c++

A friend class in C++, can access the private.protected and public members of the class in which it is declared as a friend. On declaration of friend class all member function of the friend...

Class Scope in C++

Class Scope in C++

Every class defines its own new scope and a unique type. The declarations of the class members within the class body introduce the member names into the scope of their class. Two different classes...

const variable in c++ class

const variable in c++ class

The const variable specifies whether a variable is modifiable or not. The constant value assigned will be used each time the variable is referenced. The value assigned cannot be modified during program execution. class...