programmer group

C # constructor (instance, static, private)

Microsoft official constructor doc link Whenever you createclassorstructureIts constructor is called. A class or structure may have multiple constructors with different arguments. Using constructors, programmers can set default values, restrict instantiation, and write flexible and readable code. There are three types of constructors instant constructor private constructors static constructor Modifier public Default...

programmer group

Go: function

1. Declaration syntax Func function name (parameter list) (return value){ pass } 1.func add() { pass } 2.func add(a int, b int) (int,int) { pass } 3.func add(a,b int,args...) int { pass } 4. Anonymous function       func() {       fmt.Printf("func 1\n")       }()       func(x int) {       fmt.Printf("func 2, x is %d\n", x)       }(2) ...