* New post Constructor Destructor and Inheritance& Array , Virtual base class in c++ language

Monday, 25 February 2013

0 CREATING CLASS,CONSTRUCTORS,STRUCTURE

CREATING CLASSES
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 CLASSES 
Public 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 x as integer
                    public y 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

 

PROGRAMMINGqueen Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates

Blogger Widgets