Template in C++

In  C++ programming language, Template is used to declare a group of function or class in a generic manner. Generic  means that that can process all types of data. By using template a single function can defined for a group of functions, it is called as a “function template”. Similarly, when template is associated with … Read more

Categories C++

Constructor and Destructor Calling in C++

In a C++ programming language constructor are called from base class to derived class and destructor are called reverse of constructor means from derived class to base class.                                                                                                                       Example:   Write a program to show the sequence of execution of constructor and destructor.

Output

Categories C++

Operator Overloding in C++

In a C++ language, operator overloading is one of the  important feature of c++.   It is an example of polymorphism. Polymorphism means one function having many forms .   There are different operators we use in a traditional programming  language the operator such as +,-,*,/ etc. For example: +( plus ) operator is used to … Read more

Categories C++

Destructors in C++

In a C++ Programming, Destructor is also a special member like constructor. Like a constructor, destructor have the same name as their class , preceded by a tilde(~). Destructor does not have a return type means it cant return any value. Destructor destroys the class object created by constructor. It is automatically called when object … Read more

Categories C++

Array of Object in C++

As we know array is a collection of similar data elements. We can also create array of object. Que. WAP to create a array of object. initialize and display the content of array.   OR  WAP  to create a class player and take a details from user name, age and print. Also use  array of object. … Read more

Categories C++

Static Member Function and Variables in C++

In a C++ programming we can create static function and variable by using the “static” keyword. Static Variables  In C++ programming we can create a static variable by placing the “static” keyword before the variable declaration. Once a variables declared as static, only one copy of that variable is created for the whole class.  When … Read more

Categories C++

Inline Function in C++

In a C++ language  An inline function is similar to macros. Inline function is also called as open subroutine because their code is replaced at the place of function call in the caller function.  In a C++programming  normal  function  are known as closed  subroutine because when such function are called ,the control passed to the … Read more

Categories C++

Member functions in C++

In a C++,  we can use the function within the classes. These functions are called as a member function. It can be public ,private & protected. Public member function: in a below program we have created a public function which can be accessed from outside of class.

Output

Private member function:  in a … Read more

Categories C++

Access Specifiers in C++

In a C++ language there are three types of access specifiers . They are: public private and protected. Public: A public data can be accessed by out side of the code in which it is defined . Private : A private data can not be accessed by outside of the code in which it is … Read more

Categories C++

Class & Object in C++

Class:  A class is a user defined data type which contains the data members and member function. A class forms the basis for object oriented programming.  It describes the shape and nature of the object . Any concept that we want to implement in oop’s must be encapsulated in class. The internal data of the … Read more

Categories C++