<?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 c++ with example - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/what-is-namespace-in-c-with-example/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/what-is-namespace-in-c-with-example/</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 c++ with example - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/what-is-namespace-in-c-with-example/</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>
		<item>
		<title>What is the namespace in Python ?</title>
		<link>https://www.wikitechy.com/interview-questions/python/what-is-the-namespace-in-python/</link>
					<comments>https://www.wikitechy.com/interview-questions/python/what-is-the-namespace-in-python/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Tue, 16 Aug 2022 10:15:34 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[enclosing namespace in python]]></category>
		<category><![CDATA[example for namespace in python]]></category>
		<category><![CDATA[explain namespaces in python]]></category>
		<category><![CDATA[namespace in python]]></category>
		<category><![CDATA[namespace in python hackerrank solution]]></category>
		<category><![CDATA[order of namespace in python]]></category>
		<category><![CDATA[python list namespaces]]></category>
		<category><![CDATA[python namespace object]]></category>
		<category><![CDATA[types of namespaces in python]]></category>
		<category><![CDATA[use of namespace in python]]></category>
		<category><![CDATA[what is global namespace in python]]></category>
		<category><![CDATA[what is namespace in c++ with example]]></category>
		<category><![CDATA[what is namespace in python with example]]></category>
		<category><![CDATA[what is scope in python]]></category>
		<category><![CDATA[what is the default namespace a program will run in python]]></category>
		<category><![CDATA[what is the namespace in python]]></category>
		<category><![CDATA[what is the order of namespace in which python looks for an identifier]]></category>
		<category><![CDATA[what is the use of namespace in python]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4690</guid>

					<description><![CDATA[In python a namespace is a system that has a unique name for each and every object. An object might be a method or a variable and python itself maintains a namespace in the form of a Python dictionary. Inside every directory that one can have multiple directories having a file with the same name. The [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">In python a namespace is a system that has a unique name for each and every object.</li>
<li style="text-align: justify;">An object might be a method or a variable and python itself maintains a namespace in the form of a Python dictionary.</li>
<li style="text-align: justify;">Inside every directory that one can have multiple directories having a file with the same name.</li>
<li style="text-align: justify;">The role of a namespace is like a surname, in real time example.</li>
<li style="text-align: justify;">Python interpreter understands what exact method or variable one is trying to point to in the code, depending upon the namespace, on similar lines.</li>
<li style="text-align: justify;">In this Name which means name, a unique identifier and Space which talks something related to scope.</li>
<li style="text-align: justify;">In python a name might be of any method or variable and space depends upon the location from where is trying to access a variable or a method.</li>
<li style="text-align: justify;">The namespace consists of three types, they are global namespace, built-in namespace, local namespace.</li>
</ul>
<p><img decoding="async" class="alignnone size-full wp-image-4691" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-namespaces.png" alt="" width="748" height="663" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-namespaces.png 748w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-namespaces-300x266.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-namespaces-390x346.png 390w" sizes="(max-width: 748px) 100vw, 748px" /></p>
<ul>
<li style="text-align: justify;">If python interpreter runs solely without any user-defined modules, methods, classes, etc. Some functions like print (), id () is always present, these are built-in namespaces.</li>
<li style="text-align: justify;">If user creates a module, a global namespace gets created, later the creation of local functions creates the local namespace.</li>
<li style="text-align: justify;">The global namespace encompasses the local namespace and built-in namespace encompasses global namespace.</li>
<li style="text-align: justify;">If scope of an object ends, the lifetime of that namespace comes to an end, so the lifetime of a namespace depends upon the scope of objects.</li>
<li style="text-align: justify;">Hence there is no possible to access the inner namespace’s objects from an outer namespace.</li>
</ul>
<h2 id="sample-code">Sample Code</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-python code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-python code-embed-code"># Python program processing<br/># global variable<br/> <br/>count = 10<br/>def some_method ():<br/>    global count<br/>    count = count + 10<br/>    print(count)<br/>some_method ()</code></pre> </div>
<h2 id="output">Output</h2>
<p><img decoding="async" class="alignnone size-full wp-image-4692" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace.png" alt="" width="965" height="242" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace.png 965w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-300x75.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-768x193.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-390x98.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/namespace-820x206.png 820w" sizes="(max-width: 965px) 100vw, 965px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/python/what-is-the-namespace-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
