473,387 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

dots in namespaces

PGP
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.
}
Jun 14 '06 #1
5 3427
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.
}


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() ;

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Jun 14 '06 #2
PGP

"Bruno van Dooren" <br**********************@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
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.
}


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() ;

--

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


Bruno,
Thanks for the quick reply. That works.
Jun 14 '06 #3
Another question...

In C# a namespace declaration can use dots

namespace CompanyName.System.Foo {

How might one code this in C++?
Jun 30 '06 #4
mike wrote:
Another question...

In C# a namespace declaration can use dots

namespace CompanyName.System.Foo {

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.
Jun 30 '06 #5
Heh, exactly where I am. Thanks.
Jun 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Steven Bethard | last post by:
In the "empty classes as c structs?" thread, we've been talking in some detail about my proposed "generic objects" PEP. Based on a number of suggestions, I'm thinking more and more that instead of...
24
by: Marcin Vorbrodt | last post by:
Here is an example of my code: //Header file #include <vector> using std::vector; namespace Revelation { // class definitions, etc... // class members are of type std::vector }
17
by: clintonG | last post by:
Using 2.0 with Master Pages and a GlobalBaseClass for the content pages. I understand the easy part -- the hierarchical structure of a namespace naming convention -- but the 2.0 IDE does not...
11
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.