Professional Documents
Culture Documents
Hare and Tu Rutle
Hare and Tu Rutle
// Constructor
Complex(double real = 0, double imaginary = 0) : real(real),
imaginary(imaginary) {}
// Copy Constructor
Complex(Complex &other){
real = other.real;
imaginary = other.imaginary;
}
// * 1. Overloading +
Complex operator+(Complex arg){
return Complex(real + arg.real, imaginary + arg.imaginary);
}
private:
double real;
double imaginary;
};
int main(){
Complex C1(2,3);
Complex C2(12,14);
cout<<endl<<"C4: "<<C4;
cout<<endl<<ptr[0];