CREATING CLASSES
Dim s1 as new add
Private Sub button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
textbox1.text= s1 . addition(10,20)
end sub
end class
public class add
Dim s as integer
public function addition (Byval x as integer,Byval y as integer)
s=x+y
return s
end function
end class
end class
public class cons
y=w
textbox1.text=x
textbox2.text=y
end sub
end class
The class ,we will create is very simpl
e one ,and is intended to show the basic technique of setting up a class , then creating an objects from it .The class we will create will converts the letters in a postcode to uppercase.
THE EXAMPLE OF CREATING CLASSESPublic Class Form1
Dim s1 as new add
Private Sub button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
textbox1.text= s1 . addition(10,20)
end sub
end class
public class add
Dim s as integer
public function addition (Byval x as integer,Byval y as integer)
s=x+y
return s
end function
end class
CREATING CONSTRUCTORS
The constructors are special method that provide controls over the INITIALIZATION of objects.A constructors is used in a database application to instantiate the class .The constructors is used in the tran class ,to instantiate the class.
The constructors are special method that lets you configure the objects you create from a class. We have already dealt with constructors . We are passing data to the CONSTRUCTORS the size and point classes.
EXAMPLE OF CREATING CONSTRUCTORS
Public Class Form1
Private Sub button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim p1 as new p (10,20)end sub
end class
public class cons
public y as integerpublic x as integer
public class new ( ByVal sender As System.Object, ByVal e As systemEventArgs)x=u
y=w
textbox1.text=x
textbox2.text=y
end sub
end class
0 comments:
Post a Comment