728x90
반응형
#include <iostream>

using namespace std;

/*
void printAll()
{
	cout << "printAll Fn" << endl;
}

void printAll()
{
	cout << "printAll Fn" << endl;
}

int main(void)
{
	printAll();	// Occured Compile Error

	return 0;
}
*/

/* NameSpace */
namespace A
{
	void printAll(void);
	void printAAA(void);
}

namespace B
{
	void printAll(void);

	namespace C
	{
		void printCCC(void);
	}
}

int main(void)
{
	A::printAll();
	B::printAll();
	
	A::printAAA();
	B::C::printCCC();

	return 0;
}

void A::printAll(void)
{
	cout << "printAll Fn A" << endl;
}

void A::printAAA(void)
{
	cout << "printAAA Fn AAA" << endl;
}

void B::printAll(void)
{
	cout << "printAll Fn B" << endl;
}

void B::C::printCCC(void)
{
	cout << "printAll Fn CCC" << endl;
}
728x90
반응형

'Language > C & C++' 카테고리의 다른 글

[C++] Dynamic Memory Allocation(compare malloc with new)  (0) 2022.10.17
[C++] Related to Bool datatype  (0) 2022.10.17
[C++] Related to Inline  (0) 2022.10.17
[C++] Related to Reference  (0) 2022.10.17
[C] Related to Preprocessor  (0) 2022.10.17

+ Recent posts