是否可以使用相同的名称空间&裁判课? [英] Is possible muti files using the same namespace & ref class?

查看:88
本文介绍了是否可以使用相同的名称空间&裁判课?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


使用相同的名称空间&在多文件中是可能的ref类,如以下列表所示:

Hi,
Is possible in muti-files using the same namespace & ref class, like below list:

// file A
namespace cvImglib{
     public ref class Imglib
        {
      void method1(.......)
       {
       ............
       }
      void method2(........)
       {
        .............
        }
    };
} 







and

//file B
namespace cvImglib{
     public ref class Imglib
        {
      int a,b,c;
       .......
      void method3(.......)
      {
          method1(a,b,c,....);
      }
      void method2(........)
      {
       ...........
      }
    };
} 



在这里,在文件B中,方法3找不到方法1,并且我收到错误c3861"消息.有人可以帮我吗?

非常感谢!!:)



here, in the file B, method 3 can''t find method 1,and i get the "error c3861" message. So someone could help me?

Thanks a lot!!:)

推荐答案

对于名称空间,它们并不重要.它们与功能单元或封装单元完全不同,并且……可以是任何东西.通常的做法是不仅在项目的一组文件中而且在不同的程序集中使用相同的名称空间.例如,名称空间System(以这种文字形式,没有进一步的后缀)用于与框架捆绑在一起的GAC的两个不同的.NET DLL中.
对于班级,一般的回答是否". 部分类的语法功能未在C ++/CLI中实现.相反,该语言遵循ISO C ++的原理,其中声明可以重复多次,并且只有一个定义,这使您可以以通常的C ++方式使用头文件(这种过时的东西,所以我不禁要问这样的东西在二十一世纪有可能).

请参阅以下讨论:
http://social.msdn.microsoft.com/Forums/zh_cn/vclanguage/thread/c90b43b2-4b8a-403b-b329-555efff7dc23 [
As to namespaces, they do not really matter. They are nothing like functional units or units of encapsulation and can be… well, anything. The usual practice is to utilize the same namespaces not only across a set of files of a project, but across different assemblies. For example, the namespace System (in this literal form, without further suffixes) is used in two different .NET DLLs of the GAC bundled with the Framework.

As to classes, the general answer is "no". The syntactic feature of partial classes is not implemented in C++/CLI. Instead, this language follows the principles of ISO C++, where a declaration can be repeated several times, with only one definition, which allows you to use header files in the usual C++ manner (such an archaic thing so I cannot help wondering how such stuff could be possible in XXI century).

Please see this discussion:
http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/c90b43b2-4b8a-403b-b329-555efff7dc23[^].

—SA


这篇关于是否可以使用相同的名称空间&裁判课?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆