Object class constructor

The default constructor will not accept any parameters , for example,

Public person(){

Weight = 10;

Height=10;

}

Act as initialization function.

Constructors can also customize

Public person(int wei)

{

 Weight=wei;

}

No assignment is the default value of 0;

Summary: different types and number of parameters is different constructor. The constructor has no return type class class has a default constructor for each, but once defined a custom constructor, the default will be automatically removed.

Static static 

Static fields are shared by all objects, if you need to share data can use a static member.

About static constructor

It can not be overloaded, static constructor will be executed once, execute the highest priority.

Static class

Static class not new instances, public functions, static methods can be called directly.

Guess you like

Origin www.cnblogs.com/cdjbolg/p/11756672.html