resolved 'previous definition' in 'classes'

This commit is contained in:
lucaspalomodevelop 2022-11-11 11:36:59 +01:00
parent 13077375ff
commit e254149b8d
6 changed files with 38 additions and 18 deletions

View File

@ -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";
}

View File

@ -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
{

View File

@ -1,4 +1,3 @@
#include "tier.cpp"
#include "hund.cpp"
#include "katze.cpp"
#include <stdio.h>

Binary file not shown.

View File

@ -1,22 +1,28 @@
#include<stdio.h>
#ifndef TIER_H
#define TIER_H
#include <stdio.h>
#include <string>
#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;
}
}
#endif

11
classes/tier.h Normal file
View File

@ -0,0 +1,11 @@
#include<stdio.h>
#include <string>
class tier{
public:
tier();
std::string getLaut();
protected:
std::string Laut;
};