Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #pragma once
- #include "cComplex.h"
- #include <iostream>
- using namespace std;
- int cComplex :: num = 0;
- cComplex::cComplex(double x , double y)
- {
- realy = x;
- imaginary = y;
- }
- cComplex::~cComplex()
- {
- num++;
- cout << "Destructor!@#" << endl;
- cout << num << endl;
- }
- void cComplex::print()const
- {
- cout << realy << "I*" << imaginary << endl;
- }
- cComplex cComplex ::operator+(const cComplex &x)
- {
- cComplex a;
- a.realy = x.realy + this->realy;
- a.imaginary = x.imaginary + this->imaginary;
- return a;
- }
- cComplex & cComplex ::operator+=(const cComplex &x)
- {
- this->realy += x.realy;
- this->imaginary += x.imaginary;
- return *this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement