<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Zugriff auf Funktion der Basisklasse]]></title><description><![CDATA[<p>Hallo ich habe folgenden COde</p>
<pre><code class="language-cpp">#ifndef PERSON_H
#define PERSON_H

#include &quot;GlobalInclude.h&quot;

class Team;

class Person
{
public:
	Person(string name, string prename, int age);
	~Person();

	string GetName() { return sName; }
	string GetPrename() { return sPrename; }
	int GetAge() { return iAge; }
	Team* GetTeam() { return pTeam; }

	Result SetTeam(Team *team);
	Result RemoveTeam();

private:
	string sName,sPrename;
	int iAge;
	Team *pTeam;
};

#endif

#ifndef PLAYER_H
#define PLAYER_H

#include &quot;GlobalInclude.h&quot;
#include &quot;Person.h&quot;

class Player : public Person
{
public:
	Player(string name, string prename, int age) : Person(name, prename,age)
	{
	}
	~Player();

	Result SetTeam(Team *team);
	Result RemoveTeam();

	Result SetTechnic(int index, float min, float max);
	Result SetTechnic(int index, float value);
	float GetTechnic(int indexStart, int indexEnd);

	Result SetTactic(int index, float min, float max);
	Result SetTactic(int index, float value);
	float GetTactic(int indexStart, int indexEnd);

	Result SetFitness(int index, float min, float max);
	Result SetFitness(int index, float value);
	float GetFitness(int indexStart, int indexEnd);

private:
	float aTechnic[iNumberAction], aFitness[iNumberFitness], aTactic[iNumberTactic]; 
};

#endif

// -------------------------------------------------- //
// Füge eine Referenz auf die Mannschaft hinzu
// -------------------------------------------------- //
Result Person::SetTeam(Team *team)
{
	pTeam = team;
	cout &lt;&lt; &quot;schreibe : &quot; &lt;&lt; team-&gt;GetName().c_str() &lt;&lt; &quot;\n&quot;;
	return OK;
}

// -------------------------------------------------- //
// Füge eine Referenz auf die Mannschaft hinzu
// -------------------------------------------------- //
Result Player::SetTeam(Team *team)
{
	if (team == NULL)
		return POINTER_NULL;

	if (GetTeam() != NULL)
		return POINTER_EXITS;

	if (team-&gt;AddPlayer(this) == OK)
		return Person::SetTeam(team);

	cout &lt;&lt; &quot;Set \n&quot;;

	return POINTER_EXITS;
}
</code></pre>
<p>Leider wird die Funktion aus Person::SetTeam nicht aufgerufen.<br />
Weiß jemand warum</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/262268/zugriff-auf-funktion-der-basisklasse</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 19:46:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/262268.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Mar 2010 14:07:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zugriff auf Funktion der Basisklasse on Wed, 03 Mar 2010 14:07:09 GMT]]></title><description><![CDATA[<p>Hallo ich habe folgenden COde</p>
<pre><code class="language-cpp">#ifndef PERSON_H
#define PERSON_H

#include &quot;GlobalInclude.h&quot;

class Team;

class Person
{
public:
	Person(string name, string prename, int age);
	~Person();

	string GetName() { return sName; }
	string GetPrename() { return sPrename; }
	int GetAge() { return iAge; }
	Team* GetTeam() { return pTeam; }

	Result SetTeam(Team *team);
	Result RemoveTeam();

private:
	string sName,sPrename;
	int iAge;
	Team *pTeam;
};

#endif

#ifndef PLAYER_H
#define PLAYER_H

#include &quot;GlobalInclude.h&quot;
#include &quot;Person.h&quot;

class Player : public Person
{
public:
	Player(string name, string prename, int age) : Person(name, prename,age)
	{
	}
	~Player();

	Result SetTeam(Team *team);
	Result RemoveTeam();

	Result SetTechnic(int index, float min, float max);
	Result SetTechnic(int index, float value);
	float GetTechnic(int indexStart, int indexEnd);

	Result SetTactic(int index, float min, float max);
	Result SetTactic(int index, float value);
	float GetTactic(int indexStart, int indexEnd);

	Result SetFitness(int index, float min, float max);
	Result SetFitness(int index, float value);
	float GetFitness(int indexStart, int indexEnd);

private:
	float aTechnic[iNumberAction], aFitness[iNumberFitness], aTactic[iNumberTactic]; 
};

#endif

// -------------------------------------------------- //
// Füge eine Referenz auf die Mannschaft hinzu
// -------------------------------------------------- //
Result Person::SetTeam(Team *team)
{
	pTeam = team;
	cout &lt;&lt; &quot;schreibe : &quot; &lt;&lt; team-&gt;GetName().c_str() &lt;&lt; &quot;\n&quot;;
	return OK;
}

// -------------------------------------------------- //
// Füge eine Referenz auf die Mannschaft hinzu
// -------------------------------------------------- //
Result Player::SetTeam(Team *team)
{
	if (team == NULL)
		return POINTER_NULL;

	if (GetTeam() != NULL)
		return POINTER_EXITS;

	if (team-&gt;AddPlayer(this) == OK)
		return Person::SetTeam(team);

	cout &lt;&lt; &quot;Set \n&quot;;

	return POINTER_EXITS;
}
</code></pre>
<p>Leider wird die Funktion aus Person::SetTeam nicht aufgerufen.<br />
Weiß jemand warum</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1863806</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1863806</guid><dc:creator><![CDATA[Fischkopf2009]]></dc:creator><pubDate>Wed, 03 Mar 2010 14:07:09 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriff auf Funktion der Basisklasse on Wed, 03 Mar 2010 14:18:22 GMT]]></title><description><![CDATA[<p>Ich schätze, weil team gleich NULL ist, GetTeam() ungleich NULL ist oder AddPlayer nicht OK ist. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
Breakpoint rein, dann weisst du's.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1863813</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1863813</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Wed, 03 Mar 2010 14:18:22 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriff auf Funktion der Basisklasse on Wed, 03 Mar 2010 14:24:59 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">if (team-&gt;AddPlayer(this) == OK)
        return Person::SetTeam(team);
</code></pre>
<p>Und du bist dir sicher, dass team-&gt;AddPlayer() überhaupt OK zurückgeben kann?<br />
Wie und wo rufst du AddTeam auf?</p>
<p>// edit:<br />
Naja, nach diesen Zeilen</p>
<pre><code class="language-cpp">if (team == NULL)
        return POINTER_NULL;

    if (GetTeam() != NULL)
        return POINTER_EXITS;
</code></pre>
<p>bist du sicher aus deiner Funktion draußen.<br />
entweder ist team == NULL oder eben !=NULL. und GetTeam liefert ja genau team zurück.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1863815</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1863815</guid><dc:creator><![CDATA[l&#x27;abra d&#x27;or]]></dc:creator><pubDate>Wed, 03 Mar 2010 14:24:59 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriff auf Funktion der Basisklasse on Wed, 03 Mar 2010 14:28:59 GMT]]></title><description><![CDATA[<p>Danke habe den Fehler gefunden. Der aufruf war verkehrt. Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1863820</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1863820</guid><dc:creator><![CDATA[Fischkopf2009]]></dc:creator><pubDate>Wed, 03 Mar 2010 14:28:59 GMT</pubDate></item></channel></rss>