STL
komplex.h
Go to the documentation of this file.
1 #pragma once
2 #include <iostream>
3 
6 class Komplex
7 {
8 public:
10  Komplex();
12  // |-- Standardwert
13  Komplex(double re, double im=0.0); // Parameterkonstruktor mit ein oder zwei Argumenten
15  virtual ~Komplex();
16 
17  Komplex(Komplex const & org) = default;
18  Komplex& operator=(Komplex const & org) = default;
19 
23  // |-- Member der Instanz werden durch die Methode nicht veraendert!
24  double Get_re() const
25  {
26  return _re;
27  }
31  void Set_re(double val)
32  {
33  _re = val;
34  }
38  // |-- Member der Instanz werden durch die Methode nicht veraendert!
39  double Get_im() const
40  {
41  return _im;
42  }
46  void Set_im(double val)
47  {
48  _im = val;
49  }
50 
55  // |-- Member der Instanz werden durch die Methode nicht veraendert!
56  Komplex operator+(const Komplex& rhs) const;
57 
62  bool operator<(const Komplex& rhs) const
63  {
64  return (_re < rhs._re || (_re == rhs._re && _im < rhs._im ));
65  }
70  bool operator==(const Komplex& rhs) const
71  {
72  return (_re == rhs._re && _im == rhs._im );
73  }
74 
75 protected:
76 private:
77  double _re;
78  double _im;
79 };
80 
85 std::ostream& operator<<(std::ostream& s, const Komplex& rhs);
86 
92 Komplex operator+(double lhs, const Komplex& rhs);
Definition: komplex.h:7
Komplex operator+(const Komplex &rhs) const
Definition: komplex.cpp:22
Komplex & operator=(Komplex const &org)=default
Komplex()
Definition: komplex.cpp:5
Komplex(Komplex const &org)=default
bool operator<(const Komplex &rhs) const
Definition: komplex.h:62
void Set_re(double val)
Definition: komplex.h:31
bool operator==(const Komplex &rhs) const
Definition: komplex.h:70
void Set_im(double val)
Definition: komplex.h:46
virtual ~Komplex()
Definition: komplex.cpp:17
double Get_im() const
Definition: komplex.h:39
double Get_re() const
Definition: komplex.h:24
Komplex operator+(double lhs, const Komplex &rhs)
Definition: komplex.cpp:34
std::ostream & operator<<(std::ostream &s, const Komplex &rhs)