<?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[frage zu Protected??]]></title><description><![CDATA[<p>angenommen:</p>
<pre><code class="language-cpp">class A{

  class B{
     protected: 
      DATA
  }

}
</code></pre>
<p>kann ich nun DATA nur in der klasse A und B verwenden und wenn ich irgendwo anders A::B o; machen würde kann ich mit o nicht auf DATA zugreifen!! hab ich das so richtig verstanden??</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/166018/frage-zu-protected</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 04:22:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/166018.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 Nov 2006 11:16:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to frage zu Protected?? on Sat, 25 Nov 2006 11:16:30 GMT]]></title><description><![CDATA[<p>angenommen:</p>
<pre><code class="language-cpp">class A{

  class B{
     protected: 
      DATA
  }

}
</code></pre>
<p>kann ich nun DATA nur in der klasse A und B verwenden und wenn ich irgendwo anders A::B o; machen würde kann ich mit o nicht auf DATA zugreifen!! hab ich das so richtig verstanden??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181140</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Sat, 25 Nov 2006 11:16:30 GMT</pubDate></item><item><title><![CDATA[Reply to frage zu Protected?? on Sat, 25 Nov 2006 11:37:13 GMT]]></title><description><![CDATA[<p>protected verhällt sich wie private solange keine Vererbung im Spiel ist. In diesem Fall wird ein A::B objekt nicht darauf zugreifen können.</p>
<p>Und ich sollte mir mal in die sig einfügen, dass meine Antworten aktuell nur Anfängerantworten sind und mit entsprechender Vorsicht zu genießen sind...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181157</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181157</guid><dc:creator><![CDATA[Shinja]]></dc:creator><pubDate>Sat, 25 Nov 2006 11:37:13 GMT</pubDate></item><item><title><![CDATA[Reply to frage zu Protected?? on Sat, 25 Nov 2006 11:45:19 GMT]]></title><description><![CDATA[<p>jede hilfe ist recht.. als anfänger hat mal solche theoretische fragen noch drauf.. aber ich bin voll praktiker hab schon lang keiner bücher mehr gelesen.. und weis solche sachen als gar nich mehr genau und frag dann lieber noch mal nach:)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181161</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181161</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Sat, 25 Nov 2006 11:45:19 GMT</pubDate></item><item><title><![CDATA[Reply to frage zu Protected?? on Sat, 25 Nov 2006 11:48:26 GMT]]></title><description><![CDATA[<p>BorisDieKlinge schrieb:</p>
<blockquote>
<p>kann ich nun DATA nur in der klasse A und B verwenden und wenn ich irgendwo anders A::B o; machen würde kann ich mit o nicht auf DATA zugreifen!! hab ich das so richtig verstanden??</p>
</blockquote>
<p>Naja, nicht ganz. <code>A</code> und <code>B</code> sind völlig unabhängig voneinander. Das protected bezieht sich, wie Shinja schon gesagt hat, auf die Vererbung, sprich:</p>
<pre><code class="language-cpp">class A
{
protected:
  int protected_var_;

private:
  int private_var_;
};

class B : public A
{
  void test( int foo )
  {
    protected_var_ = foo; // ok
    private_var_   = foo; // geht nicht
  }
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1181162</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181162</guid><dc:creator><![CDATA[finix]]></dc:creator><pubDate>Sat, 25 Nov 2006 11:48:26 GMT</pubDate></item></channel></rss>