C 建構函式 例子

2021-06-04 21:15:09 字數 815 閱讀 6979

//建構函式,去掉this

class person

public person(string name, string ***, int age, double weight)

public void eatfood(double quanity)

}class program

,***=,age=,weight=", firstman.name,

firstman.***, firstman.age, firstman.weight);

person secondman = new person();

console.writeline("建構函式person(string name,string ***,int age,double weight)");

console.writeline("name=,***=,age=,weight=", secondman.name,

secondman.***, secondman.age, secondman.weight);

person thirdman = new person("zhang", "woman", 25, 85);

console.writeline("建構函式person(string name,string ***,int age,double weight)");

console.writeline("name=,***=,age=,weight=", thirdman.name,

thirdman.***, thirdman.age, thirdman.weight);

console.read();}}

C 建構函式例子

已知string類定義如下 class string public string constchar str null 通用建構函式 string conststring another 拷貝建構函式 string 析構函式 string operater const string rhs 賦值函式...

c 建構函式 例子學習

using system using system.collections.generic using system.linq using system.text using system.threading.tasks namespace 複習 列印物件的時候使用的get方法 set name v...

字元函式例子

要查詢以某個字結尾等於什麼的記錄 select from vehicle 車牌號以7結尾的資料記錄 select from vehicle t where trim t.veh no like 7 用函式的方式 select from vehicle t where substr trim t.ve...