-

 -

  • (72)
  •     (45)
  • (37)
  • (1)
  • (0)
  • (23)

 -

 - e-mail

 

 -

   TheLenka

 -

 LiveInternet.ru:
: 03.01.2009
:
:
: 265

:


, 24 2009 . 16:25 +



, . namespace. std.

int.h str.h.
int.h
namespace classint
{
 class A
 {
 public:
 int Get()
 {
 return 100;
 }
 };
}

str.h
namespace classstr
{
 class A
 {
 public:
 char *Get()
 {
 return "one hundred";
 }
 };
}


#include "int.h"
#include "str.h"

, , . .

void main()
{
 classint::A i;
 cout<<i.Get()<<endl;
 classstr::A s;
 cout<<s.Get()<<endl;
 _getch();
}

, .

using , . , . , str.h class B.

using namespace std;
using namespace classint;
using namespace classstr;

void main()
{
 A i;
 cout<<i.Get()<<endl;
 B s;
 cout<<s.Get()<<endl;
 _getch();
}
“using namespace std;”, cout, std::cout.
(public private). .
namespace classint
{
private class A
 {
 public:
 int Get()
 {
 return 100;
 }
 };
}
. .
namespace A
{
 …
 namespace B
 {
 …class My {};
 }
}
A::B::My m;


using namespace A::B;
void main()
{
 My m;
}

 


: [1] []
 

:
: 

: ( )

:

  URL