-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomplex.h
61 lines (39 loc) · 1.45 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* complex.h */
#ifndef COMPLEX_H_
#define COMPLEX_H_
#include <cstddef>
class MyComplex { //Beginn der MyComplex Klasse
public:
//Constructor
MyComplex (const double & real, const double & imag);
//Default Constructor
MyComplex ();
//Copy-Constructor
MyComplex( const MyComplex & c );
//Destructor
~MyComplex ();
//Return real-part of MyComplex
const double real() const;
//Return imag-part of MyComplex
const double imag() const;
//Return norm of MyComplex
const double norm() const;
//Ausgabe aller Einträge
void print(const std::string title="", const int w=8) const; //const int w=8 default Wert für Abstand. Übergabe bei Aufruf optional
//Copy Operator
MyComplex & operator=(const MyComplex & c ); //& was ist der Unterschied zwischen MyComplex & operator, MyComplex operator
//MyComplex-Addition
const MyComplex operator+ (const MyComplex & c2) const;
//MyComplex-Addition
const MyComplex operator+ (const double & skal) const;
//MyComplex-Subtraktion
const MyComplex operator- (const MyComplex & c2) const;
const MyComplex operator-() const;
//Multiplikation mit Complex
const MyComplex operator* (const MyComplex & c2) const;
//Multiplikation mit Skalar
const MyComplex operator* (const double & lambda) const;
private:
double * dataPtr; // pointer for data
}; //Ende der Vector Kasse
#endif