namespaces

vb.net System namespace conflict with sibling namespace

我的梦境 提交于 2021-01-05 06:51:30
问题 I have a class EventArgs(Of T) in my solution. This class is located in the namespace Acme.Infrastructure.Interface . A class with the same name EventArgs exists in the System namespace. In another project in my solution I have a class Acme.BusinessModules.MyModule.MyClass When attempting to use the EventArgs class I have to fully qualify the class name or the compiler thinks I am using the System.EventArgs class. My understanding of namespace resolution was that the compiler would first look

vb.net System namespace conflict with sibling namespace

拜拜、爱过 提交于 2021-01-05 06:50:55
问题 I have a class EventArgs(Of T) in my solution. This class is located in the namespace Acme.Infrastructure.Interface . A class with the same name EventArgs exists in the System namespace. In another project in my solution I have a class Acme.BusinessModules.MyModule.MyClass When attempting to use the EventArgs class I have to fully qualify the class name or the compiler thinks I am using the System.EventArgs class. My understanding of namespace resolution was that the compiler would first look

Namespace of a function declaration nested in function

ぃ、小莉子 提交于 2021-01-02 18:47:05
问题 For odd reasons, I want to declare a function inside a function scope. So I get the following code : namespace NS { void foo() { void bar(); bar(); } } In another compilation unit, I want to define bar. Depending on the compiler I'm using, I need to put bar in namespace NS or in the global namespace to be able to link: On clang: namespace NS { void bar() {} } On MSVC: void bar() {} What's the good behavior, if any ? As a side question, why is none of the following code compiling (on my 2

Namespace of a function declaration nested in function

∥☆過路亽.° 提交于 2021-01-02 18:36:23
问题 For odd reasons, I want to declare a function inside a function scope. So I get the following code : namespace NS { void foo() { void bar(); bar(); } } In another compilation unit, I want to define bar. Depending on the compiler I'm using, I need to put bar in namespace NS or in the global namespace to be able to link: On clang: namespace NS { void bar() {} } On MSVC: void bar() {} What's the good behavior, if any ? As a side question, why is none of the following code compiling (on my 2

Namespace of a function declaration nested in function

大憨熊 提交于 2021-01-02 18:27:31
问题 For odd reasons, I want to declare a function inside a function scope. So I get the following code : namespace NS { void foo() { void bar(); bar(); } } In another compilation unit, I want to define bar. Depending on the compiler I'm using, I need to put bar in namespace NS or in the global namespace to be able to link: On clang: namespace NS { void bar() {} } On MSVC: void bar() {} What's the good behavior, if any ? As a side question, why is none of the following code compiling (on my 2

Is it possible to friend a class in an anonymous namespace in C++?

走远了吗. 提交于 2020-12-29 02:44:02
问题 I am porting code from Java to c++ and I'd like to replicate some anonymous functionalities. In file A.h I have : class A { private: int a; class AnonClass; friend class AnonClass; }; In file A.cpp I have : namespace { class AnonClass { public: AnonClass(A* parent) { parent->a = 0; // This doesn't work, a is not accessible } } } Is it possible to friend a class in an anonymous namespace in C++? In Java you can declare anonymous classes so it would be very similar. Also it would not expose

Is it possible to friend a class in an anonymous namespace in C++?

风格不统一 提交于 2020-12-29 02:41:13
问题 I am porting code from Java to c++ and I'd like to replicate some anonymous functionalities. In file A.h I have : class A { private: int a; class AnonClass; friend class AnonClass; }; In file A.cpp I have : namespace { class AnonClass { public: AnonClass(A* parent) { parent->a = 0; // This doesn't work, a is not accessible } } } Is it possible to friend a class in an anonymous namespace in C++? In Java you can declare anonymous classes so it would be very similar. Also it would not expose

How do you namespace a Dart class?

女生的网名这么多〃 提交于 2020-12-28 12:54:23
问题 How do you create a namespace for a Dart class? I come from a C# background, where one would just use namespace SampleNamespace { } . How do you achieve the same in Dart? 回答1: Dart doesn't have the concept of namespaces, but instead it has libraries. You can consider a library to be sort of equivalent to a namespace, in that a library can be made of multiple files, and contain multiple classes and functions. Privacy in Dart is also at the library, rather than the class level (anything

How do you namespace a Dart class?

[亡魂溺海] 提交于 2020-12-28 12:53:53
问题 How do you create a namespace for a Dart class? I come from a C# background, where one would just use namespace SampleNamespace { } . How do you achieve the same in Dart? 回答1: Dart doesn't have the concept of namespaces, but instead it has libraries. You can consider a library to be sort of equivalent to a namespace, in that a library can be made of multiple files, and contain multiple classes and functions. Privacy in Dart is also at the library, rather than the class level (anything

How do I copy all resources to a new namespace?

和自甴很熟 提交于 2020-12-13 03:07:44
问题 I would like to create a new namespace which is identical to the old one. My approach would look something like this (full command below): kubectl get <resources> -o json --namespace OLD-NAMESPACE | jq '.items[].metadata.namespace = "NEW-NAMESPACE"' | kubectl create -f - This basically gets all resource definitions in a json format, replaces the old namespace with the new one, and applies everything. Unfortunately, this does not work, since the old definitions contain namespace specific