diff --git a/classes/hund.cpp b/classes/hund.cpp index bc99488..69e6e27 100644 --- a/classes/hund.cpp +++ b/classes/hund.cpp @@ -1,12 +1,14 @@ -// #include "tier.cpp" +#ifndef TIER_H // ensuring that this object is only initialized once +#include "tier.cpp" +#endif class hund : public tier { - public: - hund(); +public: + hund(); }; hund::hund() : tier() { - Laut = "wuff"; + Laut = "wuff"; } \ No newline at end of file diff --git a/classes/katze.cpp b/classes/katze.cpp index 4959af9..c2d72c7 100644 --- a/classes/katze.cpp +++ b/classes/katze.cpp @@ -1,4 +1,6 @@ -// #include "tier.cpp" +#ifndef TIER_H //ensuring that this object is only initialized once +#include "tier.cpp" +#endif class katze : public tier { diff --git a/classes/main.cpp b/classes/main.cpp index 4adc7ec..ee5e36f 100644 --- a/classes/main.cpp +++ b/classes/main.cpp @@ -1,4 +1,3 @@ -#include "tier.cpp" #include "hund.cpp" #include "katze.cpp" #include diff --git a/classes/program b/classes/program index fbb60f2..056b0ff 100755 Binary files a/classes/program and b/classes/program differ diff --git a/classes/tier.cpp b/classes/tier.cpp index 66b0190..eb37fd3 100644 --- a/classes/tier.cpp +++ b/classes/tier.cpp @@ -1,22 +1,28 @@ -#include +#ifndef TIER_H +#define TIER_H +#include #include +#include "tier.h" -class tier{ - public: - tier(); +// class tier +// { +// public: +// tier(); - std::string getLaut(); - protected: - std::string Laut; -}; +// std::string getLaut(); -tier::tier() { -this->Laut = "void"; +// protected: +// std::string Laut; +// }; -} +tier::tier() +{ + this->Laut = "void"; +} std::string tier::getLaut() { return this->Laut; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/classes/tier.h b/classes/tier.h new file mode 100644 index 0000000..3671f22 --- /dev/null +++ b/classes/tier.h @@ -0,0 +1,11 @@ +#include +#include + +class tier{ + public: + tier(); + + std::string getLaut(); + protected: + std::string Laut; +};