Object Orientated Program Flashcards
Reason for OOP
Breaks code down into smaller modules with states and functionality
I.e. class solely for customers and another for food choice
Modularity
OOP enabled programmers to create modules, no change for when an object is added
Easy to Create new object
Scalability
OOP makes development and maintenance easier.
Design is modular, part can be updated without large scale changes
Data hiding
OOP can hide and secure data
Real life scenario
OOP can simulate real world
Set up for OOP
Class needs details and functionalities
Class needs
Attributes (variables)
Can be string and long
Access modifier
Keywords used to define the state of a data type
I.e public Determines how an attribute, class and method can be edited
Access modifiers can be applied to what?
Class, attributed and methods
Public vs private
Public: members can access in other classes
Prívate: only can access inside that specific class
Object
Containments of the class
“Instance if a class”
Holds data for every variable of a class, NOT PRIMITIVE DATA TYPES
Use of a class == object
Stud stud = new stud(); ^This is new object
Stud stud1 = stud; ^ this is reference variable not obj
Class vs method naming
Class is Pascal: CustomorInfo
Method is camal: customerInfo
Calling an object
= new class(parameters);