LEARNING ACTIVITY SHEET
IN SPICIAL PROGRAM IN ICT 10
ADVANCED PROGRAMMING 10
Name: ________________________________________ Date: _______________________________
Grade Level / Section: ___________________________
CLASSES AND OBJECTS
BACKGROUND INFORMATION FOR LEARNERS
Object is a combination of codes and data that can be treated as a unit. It can be a piece of an application. Like a
control or a form in applications. An entire application can be an example of an object.
What is Class?
A Class is a collection of method and variables. It is a blueprint that defines the data and behaviour of a type. It
is also a software components that defines and implements one or more interfaces.
Class Definition
A class definition starts with the keyword Class followed by the class name; and the class body, ended by the
End Class statement.
Class Members
1. Data Members / Variables
Data members includes member variables and constants.
2. Event Members
Events are procedures that are called automatically by the Common Language Runtime in response to
some action that occurs, such as an object being created, a button being clicked, a piece of data being
changed, or an object going out of scope.
3. Methods / Function members
This refers to both functions and subroutines.
4. Property Members
A property member is implemented as a Private member variable together with a special type of VB
function that incorporates both accessor functions of the property
Example 1. Create a program that displays contact information of clients using class.
VB Code:
Module Module1
Class contact
Public fname As String
Public add As String
Public mob As String
Public em As String
End Class
Sub Main()
Dim cinfo As contact = New contact
cinfo.fname = "Juan Dela Cruz"
cinfo.add = "Caloocan, Carranglan, Nueva Ecija"
cinfo.mob = "098776541234"
cinfo.em = "[email protected]"
Console.WriteLine("Name: {0}", cinfo.fname)
Console.WriteLine("Address: {0}", cinfo.add)
Console.WriteLine("Mobile No.: {0}", cinfo.mob)
Console.WriteLine("Email Address: {0}", cinfo.em)
Console.ReadKey()
End Sub
End Module
Output:
LEARNING COMPETENCY
1. Use Classes and Objects in creating a program.
ACTIVITIES
1. Create a console application that computes for the area of 3 rectangle and displays its results. Use class
to create this program. (10pts.) (1 WHOLE SHEET)
REFLECTION
1. In your own understanding. What is Classes and Objects?
____________________________________________________________________________________
____________________________________________________________________________________
____________________________________________________________________________________
____________________________________________________________________________________
REFERENCES
Electronic Resources:
https://www.pdfdrive.com/mastering-microsoft-visual-basic-2010-e43922330.html
Master Microsoft Visual Basic 2010
https://www.tutorialspoint.com/vb.net/vb.net_classes_objects.htm
VB.Net Programming Language Reference
Prepared by: GENESIS P. EUGENIO
Name of Writer/s
Noted by: LABERNE A. LADIGNON, JR.
Division ICT Coordinator / OIC EPS