-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComplex.h
35 lines (28 loc) · 844 Bytes
/
Complex.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "IMemoryManager.h"
#include "Log.h"
class Complex {
public:
Complex(): r(1), c(1) {}
Complex(double a, double b): r(a), c(b) {
}
~Complex() {
}
void* operator new (size_t size, IMemoryManager& manager){
return manager.allocate(size);
}// class' default ctor implicitly called here
void* operator new[](size_t size, IMemoryManager& manager) {
return manager.allocate(size);
}// class default ctor implicitly called here
void operator delete (void* pointerToDelete, IMemoryManager& manager) {
manager.freeMemory(pointerToDelete);
}// class' dtor implicitly called at this point
void operator delete[](void* arrayToDelete, IMemoryManager& manager) {
manager.freeMemory(arrayToDelete);
}// class' dtor implicitly called at this point
private:
//Real part
double r;
//Complex part
double c;
};