C++ Programming Tutorial

Function Overloading in C++ Programming

If more than one functions having same name but differing in terms of number and types of argument it takes is used in a class, it is known as function overloading. It is an example of compile time polymorphism (static/early binding). The compiler determines which function is called during compile time based on the number and types of argument sent.

Friend function in C++ Programming

In C++, private members remain hidden and can only be accessed by other member function of that class and friend function. Friend function is defined or declared using keyword 'friend' before the function prototype inside the class. It takes objects as parameter and access their private members using object name and dot(.) operator. Friend function is used when we need to operate on data of two or more objects of same or different classes. For e.g.

Constructors in C++ Programming

Constructors are the member functions that are executed automatically when an object is created. That means no explicit call is necessary to call a constructor. The name constructor is given because it constructs the value of the data member of class. Constructors are mainly used or initializing data.

Pages