必须拥有公有的默认构造函数。
公共的默认构造函数;例如。
序列化/逆序列化的类不需要有默认构造函数。
The class being serialized/deserialized is not required to have a default constructor.
默认构造函数调用父类的无参数构造函数。
The default constructor invoked the no - arg constructor of the superclass.
什么是默认构造函数?
下表显示了由默认构造函数返回的值类型的默认值。
The following table shows the default values of value types returned by the default constructors.
未能序列化{0}。集合和枚举数需要默认构造函数。
Could not serialize {0}. Default constructors are required for collections and enumerators.
因为我自己正在构建一个类,所以我需要显式地创建默认构造函数。
Because I'm building a class myself, I need to explicitly create the default constructor.
合成的默认构造函数一般适用于仅包含类类型成员的类。
The synthesized default constructor often suffices for classes that contain only members of class type.
保护的想法是创建一个拷贝构造函数除了默认构造函数。
The idea is to create a protected copy constructor aside from the default constructor.
对类类型来说,通过运行类的默认构造函数来初始化对象。
For class types, objects are initialized by running the class's default constructor.
这种实例化涉及到要调用的类的默认构造函数,随后还要注入依赖关系。
This instantiation involves the default constructor for the class being called, with the injection of dependencies happening afterwards.
类x的默认构造函数是指可以被无参数调用的X的构造函数。
A default constructor for a class X is a constructor of class X that can be called without an argument.
结构不能声明默认构造函数(没有参数的构造函数)或析构函数。
A struct may not declare a default constructor (a constructor without parameters) or a destructor.
清单1中的模板类源代码是类的默认构造函数,第一个方法没有出现在其中。
The first method is one that doesn't even appear in the source code for my template class back in Listing 1, the default constructor for the class.
每种值类型均有一个隐式的默认构造函数来初始化该类型的默认值。
Each value type has an implicit default constructor that initializes the default value of that type.
注意,你在使用默认构造函数时可以不用写括号(例如,没有参数的构造函数)。
Note that you can drop the parentheses when using a default constructor (i.e., one that takes no arguments).
场景3:使用jMock和RMock 模拟带有非默认构造函数的具体类
Scenario 3: Use jMock and RMock to mock a concrete class with a nondefault constructor
没有在初始化列表中初始化的类成员,使用它们的默认构造函数隐式初始化。
Class members that are not initialized in the initializer list are implicitly initialized by using their default constructor.
使用命名的程序集文件和默认构造函数,创建指定名称的COM对象的实例。
Creates an instance of the COM object whose name is specified, using the named assembly file and the default constructor.
vector的默认构造函数则生成一个没有元素的vector向量对象。
The default vector constructor generates a vector with no elements.
根据CDI规范,有一个no - arg默认构造函数使得这个类能成为托管bean。
According to the CDI specification, having a no-arg default constructor makes this class eligible to be a managed bean.
停止注册过程后,注册对象的状态将等于使用默认构造函数构造该对象后的状态。
After the registration process has been stopped, the registration object's state is equal to the state directly after being constructed by the default constructor.
为结构定义的任何构造函数都必须至少有一个参数,以便不会与默认构造函数冲突。
Any constructors that you define for structures must have at least one argument so that they do not conflict with the default constructor.
如果没有为一个类显式定义任何构造函数,编译器将自动为这个类生成默认构造函数。
If we do not explicitly define any constructors, then the compiler will generate the default constructor for us.
如果没有为一个类显式定义任何构造函数,编译器将自动为这个类生成默认构造函数。
If we do not explicitly define any constructors, then the compiler will generate the default constructor for us.
应用推荐