<?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[Brauche dringend hilfe (Vererbung)]]></title><description><![CDATA[<p>Also ich habe c++ schon mal gelernt jedoch habe ich das wesentliche vergessen. ich habe hier eine aufgabe die eigentlich ganz einfach sein muss.</p>
<p>Erzeugen Sie eine neue Klasse fwAutorot, die Sie von fwRotation erben lassen. Somit erbt die neue Klasse die vier Attribute _xa, _ya, _za und _theta, sowie die Render-Methode. Fügen Sie dieser Klasse ein fünftes Attribut vom Typ float hinzu, dass die Winkelgeschwindigkeit enthält, mit der sich um die Rotationsachse gedreht werden soll. Das Attribut _theta soll nun nicht mehr im<br />
Konstruktor als Parameter mit übergegen werden, stattdessen soll der neu zu<br />
implementierende Konstruktor von fwAutorot neben der Drehachse die Winkelgeschwindigkeit als Parameter übernemen und das neue, fünfte Attribut damit initialisieren. Das Attribut _theta soll mit 0 initialisiert werden. Ändern Sie die Render-Mehode von fwAutorot so, dass dort zunächst _theta in Abhängigkeit der<br />
Winkelgeschwindigkeit neu gesetzt wird und dann mit dem dann aktuellen Wert _theta die Rotationsmatrix gesetzt wird.</p>
<pre><code>class fwRotation : public fwNode
{
public:
	fwRotation(float xa, float ya, float za, float theta);
	virtual ~fwRotation();

	void SetRotation(float xa, float ya, float za, float theta);
	virtual bool Render();

	float _xa;
	float _ya;
	float _za;
	float _theta;
};
</code></pre>
<pre><code>//Def. von fwRotation
fwRotation::fwRotation(float xa,float ya,float za,float theta)
{
	SetRotation(xa, ya, za, theta);
}

void fwRotation::SetRotation(float xa,float ya,float za,float theta)
{
	_xa=xa;
	_ya=ya;
	_za=za;
	_theta=theta;
}

fwRotation::~fwRotation()
{
}

bool fwRotation::Render()
{
	glRotatef(_theta, _xa, _ya, _za);
	return true;
}
</code></pre>
<p>kann mir da irgendwer helfen, der grad zeit und lust hat. ich wäre sooo dankbar</p>
<p>mladdi</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/133686/brauche-dringend-hilfe-vererbung</link><generator>RSS for Node</generator><lastBuildDate>Fri, 28 Aug 2026 01:14:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/133686.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 19 Jan 2006 21:29:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Brauche dringend hilfe (Vererbung) on Thu, 19 Jan 2006 21:29:20 GMT]]></title><description><![CDATA[<p>Also ich habe c++ schon mal gelernt jedoch habe ich das wesentliche vergessen. ich habe hier eine aufgabe die eigentlich ganz einfach sein muss.</p>
<p>Erzeugen Sie eine neue Klasse fwAutorot, die Sie von fwRotation erben lassen. Somit erbt die neue Klasse die vier Attribute _xa, _ya, _za und _theta, sowie die Render-Methode. Fügen Sie dieser Klasse ein fünftes Attribut vom Typ float hinzu, dass die Winkelgeschwindigkeit enthält, mit der sich um die Rotationsachse gedreht werden soll. Das Attribut _theta soll nun nicht mehr im<br />
Konstruktor als Parameter mit übergegen werden, stattdessen soll der neu zu<br />
implementierende Konstruktor von fwAutorot neben der Drehachse die Winkelgeschwindigkeit als Parameter übernemen und das neue, fünfte Attribut damit initialisieren. Das Attribut _theta soll mit 0 initialisiert werden. Ändern Sie die Render-Mehode von fwAutorot so, dass dort zunächst _theta in Abhängigkeit der<br />
Winkelgeschwindigkeit neu gesetzt wird und dann mit dem dann aktuellen Wert _theta die Rotationsmatrix gesetzt wird.</p>
<pre><code>class fwRotation : public fwNode
{
public:
	fwRotation(float xa, float ya, float za, float theta);
	virtual ~fwRotation();

	void SetRotation(float xa, float ya, float za, float theta);
	virtual bool Render();

	float _xa;
	float _ya;
	float _za;
	float _theta;
};
</code></pre>
<pre><code>//Def. von fwRotation
fwRotation::fwRotation(float xa,float ya,float za,float theta)
{
	SetRotation(xa, ya, za, theta);
}

void fwRotation::SetRotation(float xa,float ya,float za,float theta)
{
	_xa=xa;
	_ya=ya;
	_za=za;
	_theta=theta;
}

fwRotation::~fwRotation()
{
}

bool fwRotation::Render()
{
	glRotatef(_theta, _xa, _ya, _za);
	return true;
}
</code></pre>
<p>kann mir da irgendwer helfen, der grad zeit und lust hat. ich wäre sooo dankbar</p>
<p>mladdi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/970905</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/970905</guid><dc:creator><![CDATA[mladdi]]></dc:creator><pubDate>Thu, 19 Jan 2006 21:29:20 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche dringend hilfe (Vererbung) on Fri, 20 Jan 2006 13:12:52 GMT]]></title><description><![CDATA[<p>Wohlwissend, dass ich grade Deine Hausaufgaben mache... und wohlwissend, dass mir auch keine passenden Begriffe für google einfallen, schreibe ich mal 'ne Antwort.</p>
<p>1. Die Klassendefinition leitet sich von fwRotation ab und der Konstruktor benötigt theta nicht mehr als Übergabeparameter.</p>
<pre><code class="language-cpp">class fwAutorot : public fwRotation
{
  public:
    float _omega;

    fwAutorot( float xa, float ya, float za, float omega );
    bool Render();
};

fwAutorot::fwAutorot( float xa, float ya, float za, float omega )
  : fwRotation( xa, ya, za, 0 /* theta */ )  // Konstruktor der Basisklasse rufen
{
  _omega : omega; 
}

bool fwAutorot::Render(void)
{
  /* theta Umrechnen und eintragen */

  fwRotation::Render(); // überladene Basisfunktion rufen.
}
</code></pre>
<p>Theta darfst dann noch selber berechnen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/971344</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/971344</guid><dc:creator><![CDATA[Xin]]></dc:creator><pubDate>Fri, 20 Jan 2006 13:12:52 GMT</pubDate></item></channel></rss>