From e254149b8d0112771e33109773d6c3a5c22fcecb Mon Sep 17 00:00:00 2001 From: lucaspalomodevelop Date: Fri, 11 Nov 2022 11:36:59 +0100 Subject: [PATCH] resolved 'previous definition' in 'classes' --- classes/hund.cpp | 10 ++++++---- classes/katze.cpp | 4 +++- classes/main.cpp | 1 - classes/program | Bin 17688 -> 17688 bytes classes/tier.cpp | 30 ++++++++++++++++++------------ classes/tier.h | 11 +++++++++++ 6 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 classes/tier.h 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 fbb60f2691b14d7b4d63c451f3f08417e7df8153..056b0ff547b623c4a1f90ea48aa641aef95f5563 100755 GIT binary patch delta 508 zcmbQy#WEJD$K;8|;*v*!DuoyX z7_x*QN+O{uFM-v(29wT{KLT~dO%5~>pR8aaAz94~(Q^c)n-Q++PamMz^hQ{KOiwG@vS>3K>>{)JPr! z$pX#!Bm@zUgi2qYJP~Nl1F$(i!777TASxRKAxhMsDsv`(G}dSAoUCXf&bS!J7H8Zy zInYF0@(42ngCLU>gMc_UEey~&M0HLpQx7^E2-plSpdA&M9$3z~{E`b>TZ zR1*obR{*Fc!V%S+IFK62`3|-4MXIU&} +#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; +};