<?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[Mehrdeutiges Symbol]]></title><description><![CDATA[<p>Hallo</p>
<p>Bin ein kleines Programm am schreiben, und bekomme immer folgende Fehlermeldung:</p>
<p>\stringtest\string.cpp(10) : error C2872: 'string': Mehrdeutiges Symbol</p>
<pre><code class="language-cpp">string::string(char x)
{ 
	string::a =x;	

	}
</code></pre>
<p>Kennt jemand den Fehler?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/184097/mehrdeutiges-symbol</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 14:41:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/184097.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Jun 2007 11:25:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 11:25:02 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Bin ein kleines Programm am schreiben, und bekomme immer folgende Fehlermeldung:</p>
<p>\stringtest\string.cpp(10) : error C2872: 'string': Mehrdeutiges Symbol</p>
<pre><code class="language-cpp">string::string(char x)
{ 
	string::a =x;	

	}
</code></pre>
<p>Kennt jemand den Fehler?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1303872</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303872</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 11:25:02 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 11:26:56 GMT]]></title><description><![CDATA[<p>schaut danach aus als ob du 2 klassen mit dem namen &quot;string&quot; im selben namespace hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1303875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303875</guid><dc:creator><![CDATA[inp]]></dc:creator><pubDate>Tue, 12 Jun 2007 11:26:56 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 11:27:55 GMT]]></title><description><![CDATA[<p>Vll. weil dein Funktion selbst auch &quot;string&quot; heißt?<br />
MfG<br />
Stromberg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1303877</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303877</guid><dc:creator><![CDATA[Stromberg]]></dc:creator><pubDate>Tue, 12 Jun 2007 11:27:55 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 11:30:51 GMT]]></title><description><![CDATA[<p>hier mal alles soweit wie ich das gemacht hab</p>
<pre><code class="language-cpp">//String.cpp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#include &quot;String.h&quot;
#include &quot;stringtest.h&quot;

string::string(char x)
{ 
	string::a =x;	

	}

//String.h     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#if !defined(STRING_H_INCLUDED_)
#define STRING_H_INCLUDED_

#include &lt;iostream&gt;
using namespace std;

class string 
{
public:
	string (char x);

private:

	char a;
};
#endif

//stringtest.h           %%%%%%%%%%%%%%%%%%%%

// stringtest.h: Master include File 

#ifndef STRINGTEST_H_INCLUDED_
#define STRINGTEST_H_INCLUDED_

#include &lt;iostream&gt;
#include &quot;String.h&quot;
using namespace std;

#endif // define STRINGTEST_H_INCLUDED_

//Stringtest.cpp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#include &quot;stringtest.h&quot;

int main()
{
cout &lt;&lt; 'H';
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1303880</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303880</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 11:30:51 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 11:48:05 GMT]]></title><description><![CDATA[<p>so sollte das klappen.</p>
<p>string.h</p>
<pre><code class="language-cpp">#pragma once
class string
{
public:
 string(char x);

private:
 char a;
};
</code></pre>
<p>string.cpp</p>
<pre><code class="language-cpp">#include &quot;string.h&quot;

string::string(char x) :
 a(x)
{ }
</code></pre>
<p>main.cpp</p>
<pre><code class="language-cpp">#include &quot;string.h&quot;
//include &lt;string&gt; //std::string -&gt; gleicher name wie string aus string.h
//using namespace std // fusioniert namespace std mit namespace global, potentielle mehrfache symbole mit deiner namesgebung.

int main(int, char**)
{
 string str('a');

 return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1303895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303895</guid><dc:creator><![CDATA[inp]]></dc:creator><pubDate>Tue, 12 Jun 2007 11:48:05 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 11:54:05 GMT]]></title><description><![CDATA[<p>ich bin immer dafür, eigene klassen nicht wie eingabaute typen oder klassen zu benennen!</p>
<p>naja...just my 2 cents</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1303898</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303898</guid><dc:creator><![CDATA[ser1al_ausgeloggt]]></dc:creator><pubDate>Tue, 12 Jun 2007 11:54:05 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 12:02:33 GMT]]></title><description><![CDATA[<p>inp schrieb:</p>
<blockquote>
<p>so sollte das klappen.</p>
<p>string.h</p>
<pre><code class="language-cpp">#pragma once
class string
{
public:
 string(char x);

private:
 char a;
};
</code></pre>
<p>string.cpp</p>
<pre><code class="language-cpp">#include &quot;string.h&quot;

string::string(char x) :
 a(x)
{ }
</code></pre>
<p>main.cpp</p>
<pre><code class="language-cpp">#include &quot;string.h&quot;
//include &lt;string&gt; //std::string -&gt; gleicher name wie string aus string.h
//using namespace std // fusioniert namespace std mit namespace global, potentielle mehrfache symbole mit deiner namesgebung.

int main(int, char**)
{
 string str('a');

 return 0;
}
</code></pre>
</blockquote>
<p>Danke erstmal<br />
so funktionierts. Bin zwar noch am grübeln warum und wieseo.....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1303906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303906</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 12:02:33 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 12:17:50 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>nun will ich den Übergebenen Buchstaben in eine Liste rein schreiben?</p>
<p>Frage:</p>
<p>Muss ich hierzu = überladen?? weil:Operator '=': Es konnte kein Operator gefunden werden, der einen rechtsseitigen Operanden vom Typ 'char' akzeptiert (oder keine geeignete Konvertierung möglich)</p>
<pre><code class="language-cpp">string::string(char x)  
{ 
	struct Buchstabenliste {
		char buchstabe;
		Buchstabenliste *next;} b1;

b1=x;

 }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1303920</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303920</guid><dc:creator><![CDATA[Physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 12:17:50 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 12:19:17 GMT]]></title><description><![CDATA[<p>b1.buchstabe=x;</p>
<p>ich seh schon den wald vor bäumen nicht mehr</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1303923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303923</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 12:19:17 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 12:59:58 GMT]]></title><description><![CDATA[<p>wenn ich jetzt folgendes machen will</p>
<pre><code class="language-cpp">#include &quot;string.h&quot; 
#include &lt;iostream&gt;

int main() 
{ 
 string str ='a'; 
 cout &lt;&lt; &quot;HALLO&quot; &lt;&lt; endl;

 return 0;
</code></pre>
<p>dann sagt er</p>
<p>error C2065: 'cout': nichtdeklarierter Bezeichner</p>
<p>warum das denn??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1303982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1303982</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 12:59:58 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:13:06 GMT]]></title><description><![CDATA[<p>Weil cout seit ca. 10 Jahren im Namensraum std liegt. Benutze entweder std::cout oder... Nein, da Deine Klasse &quot;string&quot; heisst, benutze std::cout.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304001</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304001</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:13:06 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:13:43 GMT]]></title><description><![CDATA[<p>entweder</p>
<pre><code class="language-cpp">...
using namespace std;
...
cout &lt;&lt; ...;
...
</code></pre>
<p>aber da wirst du eine nameskollision bekommen (mehrdeutige symbole) <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /><br />
wie im vorigen beispiel wg deiner string klasse und der std::string klasse</p>
<p>oder</p>
<pre><code class="language-cpp">...
std::cout &lt;&lt; ...;
...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1304003</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304003</guid><dc:creator><![CDATA[inp]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:13:43 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:14:43 GMT]]></title><description><![CDATA[<p>keiner eine ahnung???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304008</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304008</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:14:43 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:16:13 GMT]]></title><description><![CDATA[<p>irgendwie versteh ich das nicht.</p>
<p>kann mir vll jemand das mit dieser &quot;Namenskollision erklären&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304012</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:16:13 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:17:32 GMT]]></title><description><![CDATA[<p>kann das sein das es im namespace std auch irgendwas gibt was string heißt??</p>
<p>d.h. ich sollte meine klasse string1 oder so nennen???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304015</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:17:32 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:23:36 GMT]]></title><description><![CDATA[<p>WAS funktioniert an std::cout nicht?<br />
WAS verstehst Du nicht an &quot;wg deiner string klasse und der std::string klasse&quot;?</p>
<p>Zu string1: Nein, musst Du nicht. Dafür gibt es Namensräume. (Damit und mit etwas nachdenken sollte sich auch der Begriff &quot;Namenskollision&quot; klären)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304022</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304022</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:23:36 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:26:12 GMT]]></title><description><![CDATA[<p>Endlich hat er's...</p>
<pre><code class="language-cpp">namespace std {

    class string : public basic_string&lt; ... &gt;; // gibt's schon.
}

// und dann deine im &quot;globalen&quot; namespace:

class string;

// und dann

using namespace std;

// und dann

string foo; // boooom!
</code></pre>
<p>Also: Entweder anderer Name, bei der verwendung &quot;deines&quot; string's kein using namespace std und auf keinen Fall #include &lt;string&gt; oder deinen string in einen anderen Namespace und tierisch aufpassen...</p>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304025</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304025</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:26:12 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:27:58 GMT]]></title><description><![CDATA[<p>das std::cou funktioniert.<br />
Ich weiß nur nicht so richtig warum. und warum ich using namespace std nicht einfügen kann.</p>
<p>Ich vermute:<br />
Im namespace std gibt es wohl schon eine klasse die string heißt, und wenn ich std einfüge weiß er nicht welche klasse er verwenden soll ---&gt; namenskollision.</p>
<p>da ich std dann halt nicht eingefügt habe funktioniert cout auch nicht.</p>
<p>wenn ich jetzt meine klasse string1 nenne, und std einfüge müsste ich cout verwenden können.</p>
<p>Ist das so richtig??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304028</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:27:58 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:48:32 GMT]]></title><description><![CDATA[<p>so, habs versucht.</p>
<p>funktionieren tut es, wäre noch nett wenn mir jemand sagt ob mein verständnis dafür auch richtig ist</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304064</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304064</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:48:32 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:58:29 GMT]]></title><description><![CDATA[<p>physikus schrieb:</p>
<blockquote>
<p>so, habs versucht.</p>
<p>funktionieren tut es, wäre noch nett wenn mir jemand sagt ob mein verständnis dafür auch richtig ist</p>
</blockquote>
<p>ja hast du</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304080</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304080</guid><dc:creator><![CDATA[inp]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:58:29 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 13:58:32 GMT]]></title><description><![CDATA[<p>guck dir am besten mal irgendwo ne erklärung von namespaces an. die hier z.b.: <a href="http://de.wikibooks.org/wiki/C++-Programmierung:_Namensr%C3%A4ume" rel="nofollow">http://de.wikibooks.org/wiki/C++-Programmierung:_Namensräume</a></p>
<p>scheinst es aber grundlegend bereits verstanden zu haben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304081</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304081</guid><dc:creator><![CDATA[thordk]]></dc:creator><pubDate>Tue, 12 Jun 2007 13:58:32 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 14:16:33 GMT]]></title><description><![CDATA[<p>So, als nächstes würde ich gerne &lt;&lt; überladen, das funktionierte aber auch nicht so richtig.</p>
<pre><code class="language-cpp">//main

int main() 
{ 
 astring str ='a'; 
 cout &lt;&lt; str &lt;&lt; endl;
/klasse

private: 
 char a; 
}; 
 //Nicht-Member Funktionen fuer Ein- und Ausgabe
ostream&amp; operator&lt;&lt;(ostream&amp;,astring);

//methode
ostream&amp; operator&lt;&lt;(ostream&amp; s, astring astr) {
	return s &lt;&lt; astr;
}
</code></pre>
<p>ich bekomme zwar keinen fehler, aber ausgeben tut er auch nix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304104</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304104</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 14:16:33 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 14:27:53 GMT]]></title><description><![CDATA[<p>physikus schrieb:</p>
<blockquote>
<p>So, als nächstes würde ich gerne &lt;&lt; überladen, das funktionierte aber auch nicht so richtig.</p>
<pre><code class="language-cpp">//main

int main() 
{ 
 astring str ='a'; 
 cout &lt;&lt; str &lt;&lt; endl;
/klasse

private: 
 char a; 
}; 
 //Nicht-Member Funktionen fuer Ein- und Ausgabe
ostream&amp; operator&lt;&lt;(ostream&amp;,astring);

//methode
ostream&amp; operator&lt;&lt;(ostream&amp; s, astring astr) {
	return s &lt;&lt; astr;
}
</code></pre>
<p>ich bekomme zwar keinen fehler, aber ausgeben tut er auch nix</p>
</blockquote>
<pre><code class="language-cpp">ostream&amp; operator &lt;&lt; (ostream&amp; s, astring const&amp; astr)
{   return s &lt;&lt; astr.a;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1304117</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304117</guid><dc:creator><![CDATA[inp]]></dc:creator><pubDate>Tue, 12 Jun 2007 14:27:53 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 14:34:11 GMT]]></title><description><![CDATA[<p>&quot;astring::a&quot;: Kein Zugriff auf private Member</p>
<p>wenn ich a public mache bekomm ich einen ganzen haufen fehler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304128</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304128</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 14:34:11 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 14:38:03 GMT]]></title><description><![CDATA[<p>physikus schrieb:</p>
<blockquote>
<p>&quot;astring::a&quot;: Kein Zugriff auf private Member</p>
<p>wenn ich a public mache bekomm ich einen ganzen haufen fehler</p>
</blockquote>
<pre><code class="language-cpp">class astring
{
public:
...
 char get_a() { return a; }
private:
 char a;
}
...
ostream&amp; operator &lt;&lt; (ostream&amp; s, astring const&amp; astr)
{ return s &lt;&lt; astr.get_a();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1304134</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304134</guid><dc:creator><![CDATA[inp]]></dc:creator><pubDate>Tue, 12 Jun 2007 14:38:03 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrdeutiges Symbol on Tue, 12 Jun 2007 14:53:01 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">char astring::geta()
{
	return astring::a;
}

ostream&amp; operator &lt;&lt; (ostream&amp; s, astring  astr) 
{ return s &lt;&lt; astr.geta(); 
} 

public: 
astring (char x); 
char geta() ;

private: 
char a;

int main() 
{ 

 astring str ='X'; 

 cout &lt;&lt; str &lt;&lt; endl;
</code></pre>
<p>so gibt er mir zwar was aus, aber anstelle dem X ein seltsames zeichen???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1304147</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1304147</guid><dc:creator><![CDATA[physikus]]></dc:creator><pubDate>Tue, 12 Jun 2007 14:53:01 GMT</pubDate></item></channel></rss>