<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>c++ constructors | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/c-constructors/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Wed, 28 Dec 2022 16:33:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C++ Constructors Part-I</title>
		<link>https://studentprojects.in/software-development/cpp/c-constructors-part-i/</link>
					<comments>https://studentprojects.in/software-development/cpp/c-constructors-part-i/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Thu, 19 Jan 2023 16:30:58 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[c++ constructors]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=10104</guid>

					<description><![CDATA[<p>A function Object() { [native code] } is a unique member function that bears the class&#8217;s name. There is no return type for the function Object() { [native code] }. The objects of their class are initialised using constructors. Every time an object is formed, constructors are automatically called. Constructor characteristics in C++ An example</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/c-constructors-part-i/">C++ Constructors Part-I</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>A function Object() { [native code] } is a unique member function that bears the class&#8217;s name. There is no return type for the function Object() { [native code] }. The objects of their class are initialised using constructors. Every time an object is formed, constructors are automatically called.</p>



<p>Constructor characteristics in C++</p>



<ul>
<li>In the public portion of the class, a function Object() { [native code] } ought to be declared.</li>



<li>When an object is created, they are automatically called.</li>



<li>They lack return types and are unable to return values.</li>



<li>It may accept standard arguments.</li>
</ul>



<p>An example of how a constructor is used is</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">#include &lt;iostream&gt;
using namespace std;
 
class Employee
{
 
public:
    static int count; //returns number of employees
    string eName;
 
    //Constructor
    Employee()
    {
        count++; //increases employee count every time an object is defined
    }
 
    void setName(string name)
    {
        eName = name;
    }
 
    static int getCount()
    {
        return count;
    }
};
 
int Employee::count = 0; //defining the value of count
 
int main()
{
    Employee Harry1;
    Employee Harry2;
    Employee Harry3;
    cout &lt;&lt; Employee::getCount() &lt;&lt; endl;
}</code></pre>



<p>Output:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">3</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/c-constructors-part-i/">C++ Constructors Part-I</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/c-constructors-part-i/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
