Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2006

Tip: Looking for answers? Try searching our database.

dots in namespaces

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PGP - 14 Jun 2006 20:57 GMT
I am trying to work with some C# namespaces from managed c++. The namespaces
use a dot notation and generates a compiler error. Is there a way around
this?

#using "csharpassembly.dll"//has the namespace test and namespace
test.external under it.

void test()
{
   test::test.external::class1* p = new test::test.external::class1()
;//error C2039- test is not a member of test.
}
Bruno van Dooren - 14 Jun 2006 21:07 GMT
>I am trying to work with some C# namespaces from managed c++. The
>namespaces
[quoted text clipped - 9 lines]
> ;//error C2039- test is not a member of test.
> }

dot notation is for C#.
for C++ you use :: like you would normally do.

notation has nothing to do with the namespaces themselves.
it is just a way of saying 'this namespace is a member of that namespace'

do it like this:
test::test::external::class1* p = new test::test::external::class1() ;

Signature

Kind regards,
   Bruno van Dooren
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"

PGP - 14 Jun 2006 21:30 GMT
>>I am trying to work with some C# namespaces from managed c++. The
>>namespaces
[quoted text clipped - 18 lines]
> do it like this:
> test::test::external::class1* p = new test::test::external::class1() ;

Bruno,
Thanks for the quick reply. That works.
mike - 30 Jun 2006 15:06 GMT
Another question...

In C# a namespace declaration can use dots

namespace CompanyName.System.Foo {

How might one code this in C++?
matthew breedlove - 30 Jun 2006 16:11 GMT
> Another question...
>
[quoted text clipped - 3 lines]
>
> How might one code this in C++?

namespace CompanyName { namespace System { namespace Foo {
    class Test {

    };
}}}

I don't really know of a better way to accomplish this, but I'm open to
suggestions if anyone knows of a better solution.
mike - 30 Jun 2006 17:24 GMT
Heh, exactly where I am. Thanks.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.