dynamic Array in C++

Dynamic Arrays also Called Array List in C++ are the ones with random size, which can be expanded if needed and contracted if needed. Dynamic Arrays in C++ have the Following...

Overloading steam insertion and extraction operators in C++

For putting data into the stream and getting data from the stream, the stream insertion and extraction operators are used, Now these operators are already defined for defined datatypes in C++,...

Increment operator overloading in C++

Increment operator in C++ is used to increase the value of a variable by 1 or some other fixed interval. normally it is used in loops. Now increment operator overloading is...

Decrement operator overloading in C++

Decrement operator in C++ is used to decrease the value of a variable by 1 or some other fixed interval, normally it is used in loops. Now decrement operator can be...

Overloading Subtraction Operator in C++

Here we have overloaded subtraction operator for a specific class or one can say subtraction operator is overloaded for a self-defined data type in C++. The code is: ...

Overloading Addition operator in C++

Here we have overloaded addition operator for a specific class or one can say addition operator is overloaded for a self-defined data type in C++. The code is: ...

Area and Perimeter of rectangle in C++

Area and Perimeter both are the mathematical terms used with rectangle, area is the length multiplied by width while perimeter is the length of all sides of the rectangle. Now how...

C++ inheritance

lets have a look at the below example: // C++ inheritance #include<iostream> using namespace std;   class Point { protected:     int x,y; public:     Point(int ,int);     void display(void); };   Point::Point(int a,int b) {     x=a;     y=b; }   void Point::display(void) {      cout<<"point = "; }   class Circle : public Point {     double radius; public:     Circle(int ,int ,double );     void display(void); };   Circle::Circle(int a,int b,double c):Point(a,b) {     radius = c; }   void Circle :: display(void) {     Point::display();     cout<<" and radius = "<<radius; }   int main(void) {     Circle c(3,4,2.5);     c.display();     cout<<endl;     return 0; } In the above we took a class “point” in which we defined its attributes (its data members and member functions), then we inherited(derived) the...

Assignment Operator Overloading in C++

After we do assignment operator overloading, we will then be able to assign two variables of our self-defined datatypes. Lets have a look at the below example: // Operator overloading in C++ //assignment operator overloading #include<iostream> using namespace std;   class Employee { private:     int idNum;     double salary; public:     Employee ( ) {         idNum = 0, salary = 0.0;     }       void setValues (int a, int b);     void operator= (Employee&emp );   };   void Employee::setValues ( int idN , int sal ) {       salary = sal; idNum = idN;   }   void Employee::operator = (Employee&emp)  // Assignment operator function {     salary = emp.salary; }   int main ( ) {       Employee emp1;     emp1.setValues(10,33);     Employee emp2;     emp2 = emp1;        // emp2 is calling object using assignment operator   } Now lets explain this...

Creating Overloaded operator in C++ with example

As we know The variables of primitive data types can perform a number of different operations (functions) using operators like (+, - , /, *)/ For Example: a + b * c...