<?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[Invalid use of nonstatic data member - Fehler bei Parameterzugriff!]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe da ein Problem mit dem Programmieren einer Klasse.<br />
Und zwar sieht das ganze destilliert etwa so aus:</p>
<pre><code>class Secret {
public:
	//Konstruktor
	Secret();
	//Destruktor
	virtual ~Secret();
	//Meine Funktionen
	char feld [1024];

	void input();

};
</code></pre>
<p>Und dazu die Funktion &quot;input()&quot;</p>
<pre><code>void input(){
	char tempField [1024]; //Wie das array gefüllt wird, sei mal zweitrangig
	Secret::feld = tempField;

}
</code></pre>
<p>Und egal wie ich mich drehe bei zugriff auf feld bekomme ich den Fehler<br />
&quot;Invalid use of non-static data member&quot;</p>
<p>Vielleicht sollte noch erwähnen, dass es unter Windows mit Visual Studio so geklappt hat, ich aber jetzt Linux Ubuntu (Editor: Eclipse) verwende.</p>
<p>Ich hoffe es kann mir jemand helfen.</p>
<p>Gruß</p>
<p>Max</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/270337/invalid-use-of-nonstatic-data-member-fehler-bei-parameterzugriff</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 10:12:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/270337.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 10 Jul 2010 14:23:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Invalid use of nonstatic data member - Fehler bei Parameterzugriff! on Sat, 10 Jul 2010 14:23:58 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe da ein Problem mit dem Programmieren einer Klasse.<br />
Und zwar sieht das ganze destilliert etwa so aus:</p>
<pre><code>class Secret {
public:
	//Konstruktor
	Secret();
	//Destruktor
	virtual ~Secret();
	//Meine Funktionen
	char feld [1024];

	void input();

};
</code></pre>
<p>Und dazu die Funktion &quot;input()&quot;</p>
<pre><code>void input(){
	char tempField [1024]; //Wie das array gefüllt wird, sei mal zweitrangig
	Secret::feld = tempField;

}
</code></pre>
<p>Und egal wie ich mich drehe bei zugriff auf feld bekomme ich den Fehler<br />
&quot;Invalid use of non-static data member&quot;</p>
<p>Vielleicht sollte noch erwähnen, dass es unter Windows mit Visual Studio so geklappt hat, ich aber jetzt Linux Ubuntu (Editor: Eclipse) verwende.</p>
<p>Ich hoffe es kann mir jemand helfen.</p>
<p>Gruß</p>
<p>Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1924276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924276</guid><dc:creator><![CDATA[bertibott]]></dc:creator><pubDate>Sat, 10 Jul 2010 14:23:58 GMT</pubDate></item><item><title><![CDATA[Reply to Invalid use of nonstatic data member - Fehler bei Parameterzugriff! on Sat, 10 Jul 2010 14:41:08 GMT]]></title><description><![CDATA[<p>Mit der Syntax gehört input() nicht zu Secret sondern ist eine freie Funktion. So geht das:</p>
<pre><code class="language-cpp">void Secret::input(){
</code></pre>
<p>Ich kann aber kaum glauben, dass es einen Compiler geben soll, der dir das genau so wie es bisher da stand abgenommen haben soll. Das wäre wirklich krass gegen den Standard.</p>
<p>Nach der Änderung wird das zwar compilieren, jedoch nicht so funktionieren wie von dir gedacht, da man mit Arrays gänzlich anders umgeht. Ich verweise dich aber mal auf die C++-Äquivalente std::vector und std::string mit denen du ganz intuitiv genauso umgehen kannst wie mit anderen Variablen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1924282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924282</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 10 Jul 2010 14:41:08 GMT</pubDate></item><item><title><![CDATA[Reply to Invalid use of nonstatic data member - Fehler bei Parameterzugriff! on Sat, 10 Jul 2010 14:43:54 GMT]]></title><description><![CDATA[<p>kaum macht mans richtig, geht's!</p>
<p>danke erstmal...<br />
aber theoretisch sollte doch auch eine externe Funktion zugriff auf eine public variable haben, oder habe ich da was falsch verstanden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1924284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924284</guid><dc:creator><![CDATA[bertibott]]></dc:creator><pubDate>Sat, 10 Jul 2010 14:43:54 GMT</pubDate></item><item><title><![CDATA[Reply to Invalid use of nonstatic data member - Fehler bei Parameterzugriff! on Sat, 10 Jul 2010 14:49:11 GMT]]></title><description><![CDATA[<p>bertibott schrieb:</p>
<blockquote>
<p>kaum macht mans richtig, geht's!</p>
<p>danke erstmal...<br />
aber theoretisch sollte doch auch eine externe Funktion zugriff auf eine public variable haben, oder habe ich da was falsch verstanden?</p>
</blockquote>
<p>Jein. Dazu ist aber eine Instanz dieser Klasse notwendig.</p>
<pre><code class="language-cpp">Secret a;

a.feld = foo;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1924286</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924286</guid><dc:creator><![CDATA[.......]]></dc:creator><pubDate>Sat, 10 Jul 2010 14:49:11 GMT</pubDate></item></channel></rss>