<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 8.3 &#8212; Public vs private access specifiers</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 12:30:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: pshetty</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-96037</link>
		<dc:creator>pshetty</dc:creator>
		<pubDate>Sun, 18 Sep 2011 00:46:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-96037</guid>
		<description>yes this is true...the tutorial is great alex...but i think there are certain areas where you need to relook, for example what serenity is pointing out</description>
		<content:encoded><![CDATA[<p>yes this is true&#8230;the tutorial is great alex&#8230;but i think there are certain areas where you need to relook, for example what serenity is pointing out</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-91586</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Tue, 07 Sep 2010 20:49:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-91586</guid>
		<description>No, they&#039;re implicitly private. They only become public when you use &quot;public: &quot; before them.</description>
		<content:encoded><![CDATA[<p>No, they&#8217;re implicitly private. They only become public when you use &#8220;public: &#8221; before them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-91469</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Sun, 05 Sep 2010 19:27:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-91469</guid>
		<description>You can&#039;t initialize a class member in the class itself. (except static const int). But yes, I think you understand. Although the class wouldn&#039;t just have that member alone. Also remember class is spelled lower cased.</description>
		<content:encoded><![CDATA[<p>You can&#8217;t initialize a class member in the class itself. (except static const int). But yes, I think you understand. Although the class wouldn&#8217;t just have that member alone. Also remember class is spelled lower cased.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pankaj</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-77837</link>
		<dc:creator>Pankaj</dc:creator>
		<pubDate>Thu, 04 Feb 2010 11:24:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-77837</guid>
		<description>yes you are right serenity, we can use access specifiers(public,private and protected)and your own constructor, destructor, copy constructor and assignment operator in structs as well.</description>
		<content:encoded><![CDATA[<p>yes you are right serenity, we can use access specifiers(public,private and protected)and your own constructor, destructor, copy constructor and assignment operator in structs as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sanath</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-73658</link>
		<dc:creator>sanath</dc:creator>
		<pubDate>Sat, 05 Dec 2009 04:16:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-73658</guid>
		<description>&lt;pre&gt;By default the class access specifier is Public.&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre>By default the class access specifier is Public.</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: serenity</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-73178</link>
		<dc:creator>serenity</dc:creator>
		<pubDate>Fri, 27 Nov 2009 20:53:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-73178</guid>
		<description>&quot;One of the primary differences between classes and structs is that classes can explicitly use access specifiers to restrict who can access members of a class.&quot;
This is incorrect - *the only* difference is that classes default to private, and structs to public. You can use private: and protected: in a struct, as well as have member functions. 

They are usually used in different ways, but that&#039;s mostly for code clarity, not because you need it. You can create a struct with inheritance, member functions etc.</description>
		<content:encoded><![CDATA[<p>&#8220;One of the primary differences between classes and structs is that classes can explicitly use access specifiers to restrict who can access members of a class.&#8221;<br />
This is incorrect &#8211; *the only* difference is that classes default to private, and structs to public. You can use private: and protected: in a struct, as well as have member functions. </p>
<p>They are usually used in different ways, but that&#8217;s mostly for code clarity, not because you need it. You can create a struct with inheritance, member functions etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-64902</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Fri, 24 Jul 2009 02:01:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-64902</guid>
		<description>Hi Alex,

I want to clarify to see if I understood your statements correctly....&quot;For example, when writing a string class, it is common to declare a private member named m_nLength that holds the length of the string. If m_nLength were public, anybody could change the length of the string without changing the actual string!&quot;

Do you mean...

Class Letter
{ 
  int m_nLength = 14;
};

??????????????

Thank you.</description>
		<content:encoded><![CDATA[<p>Hi Alex,</p>
<p>I want to clarify to see if I understood your statements correctly&#8230;.&#8221;For example, when writing a string class, it is common to declare a private member named m_nLength that holds the length of the string. If m_nLength were public, anybody could change the length of the string without changing the actual string!&#8221;</p>
<p>Do you mean&#8230;</p>
<p>Class Letter<br />
{<br />
  int m_nLength = 14;<br />
};</p>
<p>??????????????</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Spock</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-39407</link>
		<dc:creator>Spock</dc:creator>
		<pubDate>Tue, 27 Jan 2009 07:11:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-39407</guid>
		<description>Another great tutorial. You write really well man.</description>
		<content:encoded><![CDATA[<p>Another great tutorial. You write really well man.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: buck</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-30414</link>
		<dc:creator>buck</dc:creator>
		<pubDate>Tue, 21 Oct 2008 13:18:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-30414</guid>
		<description>compiling code in first example gives me an error - (22) : error C2440: &#039;return&#039; : cannot convert from &#039;int&#039; to &#039;DateStruct&#039;. By adding a semi-colon (;) after closing curly brace of structure, it compiles without error. I am using MS Visual C++.

[ Oops, yes, all structs and classes must end with a semicolon.  Forgetting it will cause errors on many compilers. -Alex ]</description>
		<content:encoded><![CDATA[<p>compiling code in first example gives me an error &#8211; (22) : error C2440: &#8216;return&#8217; : cannot convert from &#8216;int&#8217; to &#8216;DateStruct&#8217;. By adding a semi-colon (;) after closing curly brace of structure, it compiles without error. I am using MS Visual C++.</p>
<p>[ Oops, yes, all structs and classes must end with a semicolon.  Forgetting it will cause errors on many compilers. -Alex ]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 8.4 &#8212; Access functions and encapsulation</title>
		<link>http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-specifiers/comment-page-1/#comment-24944</link>
		<dc:creator>Learn C++ - &#187; 8.4 &#8212; Access functions and encapsulation</dc:creator>
		<pubDate>Tue, 26 Aug 2008 04:11:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/83-public-vs-private-access-functions-and-encapsulation/#comment-24944</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 8.3 &#8212; Public vs private access specifiers &#124; Home &#124; 8.5 &#8212; Constructors &#187;     Tuesday, September 4th, 2007 at 2:21 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 8.3 &#8212; Public vs private access specifiers | Home | 8.5 &#8212; Constructors &raquo;     Tuesday, September 4th, 2007 at 2:21 [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

