STL
komplex.cpp
Go to the documentation of this file.
1 #include "komplex.h"
2 #include<iostream>
3 using namespace std;
4 
6 : _re(0.0), _im(0.0)
7 {
8  //ctor
9 }
10 
11 Komplex::Komplex(double re, double im)
12 : _re(re), _im(im)
13 {
14  //ctor
15 }
16 
18 {
19  //dtor
20 }
21 
23 {
24  Komplex tmp(_re+rhs._re, _im+rhs._im);
25  return tmp;
26 }
27 
28 ostream& operator<<(ostream& s, const Komplex& rhs)
29 {
30  s << "("<< rhs.Get_re()<< ","<<rhs.Get_im() <<")";
31  return s;
32 }
33 
34 Komplex operator+(double lhs, const Komplex& rhs)
35 {
36 // Komplex tmp(lhs+rhs.Get_re(), rhs.Get_im());
37 // return tmp;
38  return rhs+lhs; // Ruft Methode operator+ der Klasse Komplex
39 
40 }
Definition: komplex.h:7
Komplex operator+(const Komplex &rhs) const
Definition: komplex.cpp:22
Komplex()
Definition: komplex.cpp:5
virtual ~Komplex()
Definition: komplex.cpp:17
double Get_im() const
Definition: komplex.h:39
double Get_re() const
Definition: komplex.h:24
ostream & operator<<(ostream &s, const Komplex &rhs)
Definition: komplex.cpp:28
Komplex operator+(double lhs, const Komplex &rhs)
Definition: komplex.cpp:34