• Do classes that should not be instantiated have a private constructor?

    需要实例化私有构造函数吗?

    youdao

  • If a class contains only static members, remember to mark the class as static or seal the class (NotInheritable) and give the class a private constructor to avoid instance creation.

    如果包含静态成员则要记得将该类标记静态,或者密封该类(NotInheritable),并且还要该类提供一个私有构造函数避免实例创建

    youdao

  • Listing 2 shows a piece of code that results in a compile-time error because the copy constructor is private.

    清单2显示产生编译时错误代码部分因为拷贝构造函数私有的。

    youdao

  • You should mark this constructor private so that you can't accidentally call the constructor and forget to record it in your object map.

    应当构造标识私有这样不会意外调用构造器忘记记录对象映射

    youdao

  • The argument to the constructor is the fully qualified URL of the metadata service being exposed, which we construct using methods in the private class HostDescriptor.

    构造函数参数是正在显示的元数据服务限定url我们使用私有HostDescriptor中的方法构造了它。

    youdao

  • HierarchyBuilder's constructor is private, however, so I can't test it via my test class (nor do I care to); therefore, my line coverage still hovers at 88%.

    然而,因为HierarchyBuilder构造器private类型的,所以不能通过测试测试(我关心)。因此,我的覆盖率仍然只有88%。

    youdao

  • Also, for classes that have design reasons to have private or no copy constructor, this style of swapping won't work. Here's what boost: : swap gets you.

    另外对于出于设计原因拥有private构造函数而没有复制构造函数类,所以这种交换风格适用。

    youdao

  • If you're using a framework that requires this for some reason, see if you can satisfy it by providing a private no-argument constructor (which is visible via reflection).

    如果正在使用框架因为某些原因需要使用这样构造函数的话,那么您可以了解以下能否通过提供私有的无参数构造函数(经由反射可见的)来满足这一要求。

    youdao

  • The noncopyable class definition presents no surprises, as the copy constructor and operator= are declared private.

    noncopyable定义没有什么令人感到新奇的地方,因为copyconstructoroperator= 声明 private

    youdao

  • Your first solution conveys to the reader that the copy-constructor is private and is not to be used.

    第一个解决方案读者传达拷贝构造函数私有的,不能使用。

    youdao

  • The traditional way to solve this is to declare the copy-constructor private and to leave it unimplemented.

    传统方式解决这个声明拷贝构造函数私有未实现的。

    youdao

  • Which is the difference between declaring a constructor private and =delete?

    声明一个构造函数区别私人=删除?。

    youdao

  • The special constructor used for serialization should also perform thorough input validation and should be either protected or private to help protect against misuse by malicious code.

    用于序列化特殊构造函数应当进行彻底输入验证并且应当成为被保护或者私有的,帮助防范恶意代码滥用行为

    youdao

  • Do declare static classes as sealed and abstract, and add a private instance constructor, if your programming language does not have built-in support for static classes.

    如果编程语言没有静态的内置支持,则应将静态类声明密封抽象的,添加一个私有实例构造函数

    youdao

  • In the first case, you are essentially declaring a private copy constructor and then not providing any implementation.

    第一情况下基本上声明一个私有拷贝构造函数然后没有提供任何实现。

    youdao

  • If a static constructor is not private, it can be called by code other than the system.

    如果静态构造函数不是私有,则系统以外代码可以调用

    youdao

  • The programming language compiler added a default static constructor to your type and did not make it private.

    编程语言编译器类型添加默认静态构造函数,但设置为私有。

    youdao

  • So just making a constructor private doesn't communicate the intention very well, and the resulting error is not very clear, either.

    所以仅仅一个构造函数私有并不交流意图由此产生的错误不是很清楚,。

    youdao

  • Note that if you do not use an access modifier with the constructor it will still be private by default.

    注意如果不对构造函数使用访问修饰符,则默认情况下私有构造函数。

    youdao

  • The constructor still exists, but it is private, and can only be invoked from within another class member function.

    构造函数仍然存在私人的,只能内部调用另一个成员函数。

    youdao

  • The constructor still exists, but it is private, and can only be invoked from within another class member function.

    构造函数仍然存在私人的,只能内部调用另一个成员函数。

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定