diff --git a/classes/hund.cpp b/classes/hund.cpp index 69e6e27..dc7199a 100644 --- a/classes/hund.cpp +++ b/classes/hund.cpp @@ -1,6 +1,5 @@ -#ifndef TIER_H // ensuring that this object is only initialized once #include "tier.cpp" -#endif + class hund : public tier { diff --git a/classes/katze.cpp b/classes/katze.cpp index c2d72c7..b49cf54 100644 --- a/classes/katze.cpp +++ b/classes/katze.cpp @@ -1,6 +1,5 @@ -#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 ee5e36f..28d0e80 100644 --- a/classes/main.cpp +++ b/classes/main.cpp @@ -1,12 +1,21 @@ #include "hund.cpp" #include "katze.cpp" +#include "tier.cpp" #include #include #include -int main(){ - katze a; - std::string laut = a.getLaut(); - std::cout << laut << std::endl; +int main() +{ + tier arr[2]; + arr[0] = katze(); + arr[1] = hund(); + + for (size_t i = 0; i < 2; i++) + { + std::string laut = arr[i].getLaut(); + std::cout << laut << std::endl; + } + return 0; } \ No newline at end of file diff --git a/classes/program b/classes/program index 056b0ff..a9fa30e 100755 Binary files a/classes/program and b/classes/program differ diff --git a/classes/tier.cpp b/classes/tier.cpp index eb37fd3..055fe43 100644 --- a/classes/tier.cpp +++ b/classes/tier.cpp @@ -4,17 +4,6 @@ #include #include "tier.h" -// class tier -// { -// public: -// tier(); - -// std::string getLaut(); - -// protected: -// std::string Laut; -// }; - tier::tier() { this->Laut = "void";