Oops Demo
Oops Demo
METHODS---------------------------------------------------
1) Instance Methods
- setter/getter methods
creation, calling.
2) Class Methods
-access class methods by using classname or object reference
3) Static Methods
- won't use any instance or class variables generally as usage.
-access static methods by using classname or object reference
----------------------------------------------------
OOPS:
-------------------------------Inheritances (IS-A
Relationship)-------------------------------------------
Single Inheritance
Multi Level Inheritance
Hierarchical Inheritance
Multiple Inheritance
Hybrid Inheritance
Cyclic Inheritance
MRO
Composition vs Aggregation:
- strongly associated and that strong association is
nothing but Composition.
-weak association is nothing but Aggregation.
-object and its instance variables is always Composition where as the
relation between object and static variables is Aggregation.
------------------------------------------------------------
POLYMORPHISM---------------------------------------------
Overloading:
2) Method Overriding
3) Constructor Overriding
-------------------------------------------------
ABSTRACTION-----------------------------------------------------------
- abstract class can have both methods
-an abstract class contains only abstract methods such type of abstract class is
considered as interface
-----------------------------------------------------------------------------------
--------------------------------------------
Class
object / instance
----------------------------------------
1) Instance Variables (Object Level Variables)
- Inside Constructor by using self variable
- Inside Instance Method by using self variable
- Outside of the class by using object reference variable
- How to delete Instance Variable from the Object
- If we change the values of instance variables of one object then those changes
won't be
reflected to the remaining objects.
2) Static Variables (Class Level Variables) : variables we have to declare with in
the class directly but outside of methods
In general we can declare within the class directly but from out side of any method
Inside constructor by using class name
Inside instance method by using class name
Inside classmethod by using either class name or cls variable
Inside static method by using class name
Constructor Concept