Professional Documents
Culture Documents
Women’s Campus
MIS 102
INTRODUCTION TO INFORMATICS
MODULE 01
Introduction to Classes and Objects
Lecture
Functions
Functions Data
Functions Functions Functions
Functions
Functions
Functions Functions
Procedural OOP
© Yanbu University College Slide 8
Concept of Class and Object
• CLASS:
o Refers to a blueprint and
definition of object
o Properties and methods
of objects are defined in class.
o It is a mechanism of creating objects.
Interactions
o Khalid lives in the house
o Khalid drives the car
o Khalid reads the book
© Yanbu University College Slide 10
Concept of Class and Object
• An object has
o State (attributes)
o Well-defined behavior (operations/methods)
o Unique identity
• Example – Khalid is an Object
o State (Attributes)
⁻ Name
⁻ Age
o Behavior (Operations/Methods)
⁻ Walks
⁻ Eats
o Identity
⁻ His name
© Yanbu University College Slide 11
Concept of Class and Object
• OBJECT:
o OO model consists of several interacting objects
o It is an instance of a class.
o Each object has a class which
defines its data and behavior
• Syntax:
Class ClassName
End Class
• Example:
Class Employee
End Class
© Yanbu University College Slide 14
How to create Class and Objects
Class Instantiation
1. Declare an object variable of type Employee. The
variable is called AliEmployee Constructor
2. Instantiate Employee with the keyword New is a special
type of
Dim AliEmployee As Employee method that
is used only
AliEmployee = New Employee() when an
object is
Call to created to
Constructor initialize the
object data.
Class Employee
Public Sub CalculatePay ()
' Do something here
End Sub
©End Class
Yanbu University College Slide 18
Methods
• Method Variables
o Variables declared within methods are called method
variables.
o They have method scope
• Calling Methods
o A method is not executed until it is called.
o A method is called by referencing its name along with
any required parameters