تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] توريث خصائص كلاس لاخر
#4
الكود التالي يوضح لك بعضا من الأفكار في كيفية كتابة الكلاس بشكل بسيط

PHP كود :
Public Class AliClass
    Implements ICloneable

    Public Property Text 
As String

    Public 
Function Clone() As Object Implements ICloneable.Clone
 
       Return Me.CreateDeepCopy(CreateShallowCopy())
 
   End Function

 
   Friend Function CreateDeepCopy(current As AliClass) As AliClass
        Return current
    End 
Function

 
   Friend Function CreateShallowCopy() As AliClass
        Return CType
(Me.MemberwiseClone(), AliClass)
 
   End Function

End Class 


الإستخدام

هناك أساليب كثيرة لإستخدام الكلاس الان
و الكود التالي يوضح بعضا منها

PHP كود :
Public Class Form1
    Private Sub Form1_Load
(sender As ObjectAs EventArgsHandles MyBase.Load
        Dim c1 
As New AliClass
        c1
.Text "Any Name"

 
       'Dim c2 As AliClass = c1
        '
Me.Text c2.Text

        Dim c2 
As AliClass Nothing
        If TypeOf c1 Is ICloneable Then
            c2 
CType((CType(c1ICloneable)).Clone(), AliClass)

 
       End If

 
       Me.Text c2.Text

        
' or
        c2.Text = ""
        Dim c3 As AliClass = c2.Clone
        Me.Text = c3.Text

    End Sub
End Class 
الرد }}}
تم الشكر بواسطة: ali.alfoly


الردود في هذا الموضوع
توريث خصائص كلاس لاخر - بواسطة ali.alfoly - 07-03-17, 02:11 PM
RE: توريث خصائص كلاس لاخر - بواسطة silverlight - 07-03-17, 05:51 PM
RE: توريث خصائص كلاس لاخر - بواسطة مساعدة - 07-03-17, 05:52 PM
RE: توريث خصائص كلاس لاخر - بواسطة silverlight - 07-03-17, 06:14 PM
RE: توريث خصائص كلاس لاخر - بواسطة ali.alfoly - 08-03-17, 12:22 PM


التنقل السريع :


يقوم بقرائة الموضوع: