扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在本页阅读全文(共2页)
Public Class dogClass dog Private s_name As String Private s_color As Color Private s_age As Integer Public Sub New()Sub New() s_name = "塞北的雪" s_age = 22 s_color = System.Drawing.Color.Red End Sub Public Property Name()Property Name() As String Get Return s_name End Get Set(ByVal value As String) s_name = value End Set End Property Public Property Color()Property Color() As Color Get Return s_color End Get Set(ByVal value As Color) s_color = value End Set End Property Public Property Age()Property Age() As Integer Get Return s_age End Get Set(ByVal value As Integer) s_age = value End Set End Property Public Shared Operator +(ByVal a As dog, ByVal b As dog) Dim c As New dog c.Name = a.Name + b.Name c.Age = a.Age + b.Age c.Color = Color.FromArgb((a.Color.ToArgb + b.Color.ToArgb) / 2) Return c End Operator End Class |
Dim a As New dog Dim b As New dog() If a Is b Then MsgBox("True") Else MsgBox("False") End If b = a b.Name = "NorthSnow" If a Is b Then MsgBox("True") Else MsgBox("false") End If 'false 'true |
Dim sb As New System.Text.StringBuilder Dim m As New dog Dim n As New dog Dim c As dog m.Name = "NorthSnow" c = m + n sb.AppendLine() sb.Append(m.Name) sb.Append("--") sb.Append(m.Age) sb.Append("--") sb.Append(m.Color.ToArgb) sb.AppendLine() sb.Append(n.Name) sb.Append("--") sb.Append(n.Age) sb.Append("--") sb.Append(n.Color.ToArgb) sb.AppendLine() sb.Append(c.Name) sb.Append("--") sb.Append(c.Age) sb.Append("--") sb.Append(c.Color.ToArgb) MsgBox(sb.ToString) 'NorthSnow--22---65536 '塞北的雪--22---65536 'NorthSnow塞北的雪--44---65536 |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者