struct T_ChildStruct
成都創(chuàng)新互聯(lián)公司主營朔州網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,手機APP定制開發(fā),朔州h5重慶小程序開發(fā)公司搭建,朔州網(wǎng)站營銷推廣歡迎朔州等地區(qū)企業(yè)咨詢
{
int nChildData;
string strChildData;
T_ChildStruct()
{
nChildData = 0;
strChildData = ""; // string可以不用寫初始化,本身構(gòu)造中就有
}
};
struct T_FatherStruct
{
int nFatherData;
string strFatherData;
T_ChildStruct arrChild[10];
T_FatherStruct()
{
nFatherData = 0;
strFatherData = "";
}
};
1、先定義一個結(jié)構(gòu)體
2、初始化并定義一個結(jié)構(gòu)體的變量
3、使用該變量即可
結(jié)構(gòu)體無法初始化值,你可以用類實現(xiàn),或者寫一個構(gòu)造函數(shù),把值傳進去。
Public Structure wheelmodel
Public ID As Short
Public swapway() As Short
Public start As Short
Public Sub New(ByVal Size As UShort) 'Size就是傳入的數(shù)組的大小
swapway = New Short(Size) {}
End Sub
End Structure
調(diào)用的時候:
Dim x As wheelmodel = New wheelmodel(10)