VC++ namespace

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Am I right in assuming that a managed C++ namespace definition can't include the period, unlike C#?

e.g. namespace myApp.Diagnostics -> causes syntax error

whereas the above compiles ok in C#

Thanks

Jon
 
Hi Jon,
Hi

Am I right in assuming that a managed C++ namespace definition can't include the period, unlike C#?

e.g. namespace myApp.Diagnostics -> causes syntax error

whereas the above compiles ok in C#

Yes, you're right. In C++, you'd need to say:
namespace myApp {
namespace Diagnostics {
....
}
}

That is, nesting namespaces to get the same effect.
Besides, in any case, the period is not the scope separator in C++ (it is in
C#, though); in C++ you'd use the double colon :: ;)
 
Thanks

Tomas Restrepo (MVP) said:
Hi Jon,


Yes, you're right. In C++, you'd need to say:
namespace myApp {
namespace Diagnostics {
....
}
}

That is, nesting namespaces to get the same effect.
Besides, in any case, the period is not the scope separator in C++ (it is in
C#, though); in C++ you'd use the double colon :: ;)
 
Back
Top