Difference between constructor and copy constructor Constructor Copy Constructor A default constructor is used to initialize data member of an object A copy constructor is used to copy the value …
Read More »Define constructor and write rules of constructor
Define constructor A constructor is a special type of member function that initializes an object automatically when it is created. Rules: The name of the constructors must be the same …
Read More »Different between Function overloading and Function overriding
Different between Function overloading and Function overriding Function overloading Function overriding Parameter must be different Parameter must be same It occurs with the same class It occurs different parent class …
Read More »Define Overloading and Overriding
Define Overloading If we create two or more members having same name but different in numbers or type of parameters, it is known as overloading. Two types of overloading – …
Read More »Define manipulators. Give Example
Manipulators are operators that are used to format data display. The most commonly used manipulators are setw() and endl, There are few manipulators – Setw() Setbase Setprecision() Setfill() Endl Showpoint …
Read More »Discuss inline function, default arguments and friend function in C++
Inline function: Inline function is an important feature that is commonly used with classes. If a function is inline, the compiler places a copy of the code of that function …
Read More »Difference between call by value and call by reference
Difference between call by value and call by reference Call by value Call by Reference A copy of value is passed to function An address of value is passed to …
Read More »OOP Code Example of Call By Reference and Return By Reference
Call by reference void swap(int &x, int &y) { int temp = x; x = y; y = temp; cout<<x<<”\\”<<y<<endl; } int main() { int main x = 6; swap(m,n); …
Read More »Difference between Reference variable and Pointer variable
Difference between Reference variable and Pointer variable Reference Variable Pointer Variable A reference can be used directly A pointer needs to deference with * to access memory location A reference …
Read More »Define Reference variable and Example
Reference variable A reference variable in C++ is a variable that acts an alias to another variable Syntax: data_type &ref_var = previous_var ; Example: int main(){ int x = 5; …
Read More »