首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

怎么用类

2012-01-08 
如何用类在vb6.0中基本用函数和过程来解决问题,现在vb.net完全面向对象了,在vb.net中如何用类来解决问题啊

如何用类
在vb6.0中基本用函数和过程来解决问题,现在vb.net完全面向对象了,在vb.net中如何用类来解决问题啊,写类有什么原则啊

[解决办法]
该问题无法回答,随便看看任何面向对象语言的教材都能找到答案。
[解决办法]
如果你“在vb6.0中基本用函数和过程来解决问题”...建议你彻底忘掉VB...从一本最基础的.NET入门书开始看...
[解决办法]
最好去学习什么是对象,把观念转变一下。
[解决办法]
忘了你的VB6吧
[解决办法]
Public Class Customer
Public Sub New()
Debug.WriteLine( "setuped ")

End Sub

'--------New(Byval)---------
Public Sub New(ByVal sname As String)
Name = sname
Debug.WriteLine(Name & "setuped ")
End Sub

Private m_Name As String
Property Name() As String
Get
Return m_Name
End Get
Set(ByVal Value As String)
m_Name = Value
End Set
End Property
Private m_address As String
Property Address() As String
Get
Return m_address
End Get
Set(ByVal Value As String)
m_address = Value
End Set
End Property

Public Function PlaceOrder() As String

End Function

Public Function CheckOrderStatus() As String

End Function

Public Overridable Function CalculateDiscount() As String
Return "base class "
End Function
End Class
-------------------------------
Public Class SubPro : Inherits Customer

Private m_zfjg As String
Property Zfjg() As String
Get
Return Zfjg
End Get
Set(ByVal Value As String)
m_zfjg = Value
End Set
End Property

Private m_bsc As String
Property Bsc() As String
Get
Return m_bsc
End Get
Set(ByVal Value As String)
m_bsc = Value
End Set
End Property

Public Overrides Function CalculateDiscount() As String
Return "sub class "
End Function
Public Function SubProSelf() As String

End Function
Public Sub New()
MyBase.New()
End Sub
End Class

热点排行