【例题】类型定义

  勇芳 2017-3-31 6689

''
'' 类型别名:
''

	type myint as integer

	dim a as myint = 5
	print a

''
'' 特别适用于长类型(避免所有类型):
''
	type MyProcPtr as function( byval as integer, byval as integer ) as integer

	dim p1 as MyProcPtr
	dim p2 as MyProcPtr
	dim p3 as MyProcPtr
	dim p4 as MyProcPtr

''
'' 提前声明:
''
	'' 声明 MyType 为尚未执行的类型 
	type MyType as RealMyType

	'' 向前声明的类型可以使用指针和引用
	type FooBar
		as MyType ptr p
	end type
	dim as MyType ptr p
	declare sub foo( byref x as MyType )

	'' 这里的执行
	type RealMyType
		as integer a, b
	end type

''
'' 声明类型的行为:
'' (即void类型,只是一种类型的名字,不是真正的“执行”)
''
	type MyAny1 as any
	type MyAny2 as MyAny2


因国家互联网安全管理要求,关闭回帖功能。大家需要留言,请使用【勇芳软件客服】即时联系勇芳点此打开->>勇芳软件客服
返回
联系勇芳
发新帖 搜索 反馈 回顶部