OOP Flashcards
(30 cards)
what is oop
= a programming methodology centered around the concepts of classes and objts
used to transfer a model of the rw > sw.
Why? to simplify dev and maintainance.
eg: pet main system for dogs.
what is design process?
what is a class
a class is a blueprint from which individual objts are created.
what is a object
any thing that has a state and behavior.
eg-car
state(attritubutes)
-make, model, size
behavior
- move, reverse, turn
what are advantages of oop over procedure
dev and maint easier. > as complexity increases
hides data whereas procedural allows global.
what is a constructor
a code block similar to a method.
used to initialized the object.
when is a constructor called
when an object is created. it constructs the value at that time.
what are the rules for creating a constructor
3 name = class name no explicit return type cant be FASS final, abstract, synchronized, static
what are the types of constructors
2
default = compiler creates w/o parameter
parameterized = has parameter when created
constructor overloading
a technique of having more than 1 constructor w/ diff parameter lists.
arranged in a way the each constructor performs diff task.
what are differences btwn constructors and methods
c (5) used to initialize state of objt must not have return type invoked implicitly provided by compiler name must be same as class
m expose behavior of objt must have return type invoke explicitly not provided by compiler name may or may not be same as class
= a methodology to design a program using classes and objts.
it simplifies sw dev + maintainance via core concpets of oc pai en
oop
is a blueprint from which individual objts are created.
class
any thing that has a state and behavior.
objt
dev and maint easier. > as complexity increases
hides data whereas procedural allows global.
what are advantages of oop over procedural
a code block similar to a method.
used to initialized the object.
constructor
when an object is created. it constructs the value at that time.
when a constructor is called
3 name = class name no explicit return type cant be FASS final, abstract, synchronized, static
rules for creating a constructor
default = compiler creates w/o parameter parameterized = has parameter when created
what are the types of constructors
a technique of having more than 1 constructor w/ diff parameter lists.
arranged in a way the each constructor performs diff task.
constructor overloading
used to initialize state of objt must not have return type invoked implicitly provided by compiler name must be same as class
m expose behavior of objt must have return type invoke explicitly not provided by compiler name may or may not be same as class
differences btwn constructor and method
What are the pillars of oop
Polymorphism
Abstraction
Inherientence
encapsulation
what are advantages of encapsulation
read-only or write only
control over the data
data hiding
easy to test
what are access modifiers
private
public
protected
default
Polymorphism
Abstraction
Inherientence
encapsulation
What are the pillars of oop