<?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>what is namespace in cpp - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/what-is-namespace-in-cpp/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/what-is-namespace-in-cpp/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Fri, 19 Aug 2022 12:20:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>what is namespace in cpp - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/what-is-namespace-in-cpp/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is namespace in C++ ?</title>
		<link>https://www.wikitechy.com/interview-questions/cpp/what-is-namespace-in-cpp/</link>
					<comments>https://www.wikitechy.com/interview-questions/cpp/what-is-namespace-in-cpp/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Fri, 19 Aug 2022 12:20:28 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[advantages of namespace in c++]]></category>
		<category><![CDATA[namespace example]]></category>
		<category><![CDATA[namespace in c++]]></category>
		<category><![CDATA[what is namespace in c plus plus]]></category>
		<category><![CDATA[what is namespace in c++]]></category>
		<category><![CDATA[what is namespace in c++ with example]]></category>
		<category><![CDATA[what is namespace in cpp]]></category>
		<category><![CDATA[what is namespace std in c++]]></category>
		<category><![CDATA[what is std in c++]]></category>
		<category><![CDATA[what is the purpose of namespace in c++]]></category>
		<category><![CDATA[what is the use of namespace in c++]]></category>
		<category><![CDATA[what is using namespace std in c plus plus]]></category>
		<category><![CDATA[what is using namespace std in c++]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4814</guid>

					<description><![CDATA[In C++ namespace is a logical division of the code which is designed to stop the naming conflict. In C++ namespace defines the scope where the identifiers such as variables, class, functions are declared. The main purpose of using namespace is to remove the ambiguity in C++. If different task occurs with the same name [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">In C++ namespace is a logical division of the code which is designed to stop the naming conflict.</li>
<li style="text-align: justify;">In C++ namespace defines the scope where the identifiers such as variables, class, functions are declared.</li>
<li style="text-align: justify;">The main purpose of using namespace is to remove the ambiguity in C++. If different task occurs with the same name their ambiguity occurs.</li>
<li style="text-align: justify;">In different namespaces functions are declared, for example if there are two functions exist with the same name such as add (), In order to prevent this ambiguity, the namespace is used.</li>
<li style="text-align: justify;">C++ language consists of a standard namespace which contains inbuilt classes and functions.</li>
<li style="text-align: justify;">In our program by using the statement &#8220;using namespace std;&#8221; includes the namespace &#8220;std&#8221;.</li>
</ul>
<h2 id="syntax">Syntax</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-cpp code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-cpp code-embed-code">namespace namespace_name  <br/>{  <br/>     //body of namespace;  <br/>}  </code></pre> </div>
<h2 id="syntax-of-accessing-the-namespace-variable">Syntax of accessing the namespace variable</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-cpp code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-cpp code-embed-code">namespace_name::member_name; </code></pre> </div>
<h2 id="sample-code">Sample code</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-cpp code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-cpp code-embed-code"> using namespace std;  <br/>namespace addition  <br/>{  <br/>    int a=5;  <br/>    int b=5;  <br/>    int add()  <br/>    {  <br/>        return(a+b);  <br/>    }  <br/>}  <br/>  <br/>int main() {  <br/>int result;  <br/>result=addition::add();  <br/>cout&lt;&lt;result;  <br/>return 0;  <br/>      }  </code></pre> </div>
<h2 id="output">Output</h2>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4815" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-1.png" alt="" width="1396" height="117" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-1.png 1396w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-1-300x25.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-1-1024x86.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-1-768x64.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-1-390x33.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-1-820x69.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-1-1180x99.png 1180w" sizes="(max-width: 1396px) 100vw, 1396px" /></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/cpp/what-is-namespace-in-cpp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
