VB.NET 怎样才算是一个完整的类?

来源:百度知道 编辑:UC知道 时间:2024/05/17 05:25:26
要满足怎样的要求? 需要哪些元素??

我写的这个错在哪里?
为井字游戏写的库
写的不怎么好,准备边写边调的’但是却在模块里不能创建引用

Public Class Ctictactoe
Private m As Integer(,)
Private i, j As Integer
Private output As String = ""
Private count As Integer = 1

Public Sub New()

m = New Integer(2, 2) {{-1, -2, -3}, {-4, -5, -6}, {-7, -8, -9}}
End Sub

Public Sub A(ByVal s As Integer, ByVal k As Integer)
i = s
j = k
If m(i, j) < 0 Then
m(i, j) = 1
count += 1
output += "Play1 get the palce(" & i & "," & j & ")" & vbCrLf
Else
output += "you cannot take this palce" & vbCrLf

End If

End Sub

Public Sub B(ByVal s As Integer, ByVal k As Integer)
i = s
j = k
If m(i, j) < 0 Then

如果你在同一工程里用,直接用就行
如果你在不同的工程里用,则要编译成dll或其他,然后再添加引用
比如你Ctictactoe类的工程名称为 XXX
就引用 XXX,

dim x as new xxx.Ctictactoe

我最近在做一个类似的游戏,遇到相同的问题,顶!!