I am working on this assignment, compiler is giving me 2 errors but I couldn't find any mistakes.
#include<iostream>
using std::cout;
using std::endl;
class opOverload
{
public:
opOverload();
opOverload(int,int);
opOverload operator+(opOverload);
void show();
private:
int sub1;
int sub2;
};
#include<iostream>
using std::cout;
using std::endl;
#include"opOverload.h"
//default constructor
opOverload::opOverload()
{
}
opOverload::opOverload(int a, int b)
{
sub1 = a;
sub2 = b;
}
//opeartor overloading begins here
opOverload opOverload:: operator+(opOverload obj)
{
opOverload temp;
temp.sub1 = sub1 + obj.sub1;
temp.sub2 = sub2 + obj.sub2;
return temp;
}
#include<iostream>
using std::cout;
using std::endl;
# include "opOverload.h"
void main()
{
opOverload obj1 = (10,20);
opOverload obj2 = (30,40);
obj1 = obj1 + obj2;
obj1.show();
}