Object Oriented Programming
Object Oriented Programming
© PakDev.net
Agenda
Understand Classes and Objects
Access Modifiers and Static keyword
Constructors and Overloads
© PakDev.net
Classes and Objects
Classify based on common behaviour or
attributes
A data structure that includes both data and
functions
An object is an instance of a class
A class is a blueprint for an object
Encapsulation: Combining data and methods
© PakDev.net
Access Modifiers and Static
Methods are public, accessible from the outside
Data is private, accessible only from the inside
Static data describes information for all objects
of a class
Static methods can only access static data
© PakDev.net
Constructors
Called automatically when the object is created
Compiler creates a default constructor
If there is an explicit constructor, then compiler
does not create one
Constructor name should be same as the class
name
Constructor return type is always void
Constructors can be overloaded
© PakDev.net
Classes and Constructors
Demo
© PakDev.net
Demonstration Steps
Create an BankAccount Class
© PakDev.net
Thank you
PakDev.net
© PakDev.net