0% found this document useful (0 votes)
20 views3 pages

Oops Demo

The document discusses various object-oriented programming concepts including: 1. Instance methods, class methods, and static methods and how they are accessed. 2. Inheritance relationships like single, multi-level, hierarchical, and multiple inheritance. 3. Composition and aggregation, how they differ, and when each relationship is used.

Uploaded by

sumuece9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Oops Demo

The document discusses various object-oriented programming concepts including: 1. Instance methods, class methods, and static methods and how they are accessed. 2. Inheritance relationships like single, multi-level, hierarchical, and multiple inheritance. 3. Composition and aggregation, how they differ, and when each relationship is used.

Uploaded by

sumuece9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

---------------------------------------------------

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:

- Inside a class we can declare any number of inner classes.

-------------------------------Inheritances (IS-A
Relationship)-------------------------------------------
Single Inheritance
Multi Level Inheritance
Hierarchical Inheritance
Multiple Inheritance
Hybrid Inheritance
Cyclic Inheritance
MRO

Super keyword usages:


- From child class we are not allowed to access parent class instance
variables by
using super(), Compulsory we should use self only.
But we can access parent class static variables by using super()
- All types of methods can be accessed using super() from parent to child
- In child class static method we are not allowed to use super() generally
(But in
special way we can use)
-----------------------------------------------------------------------------------
---------------------
Has-A Relationship ( Composition)
- we can access members of one class inside
another class is nothing but composition (Has-A Relationship)

when to use : IS-A & HAS-A Relationship ?

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:

There are 3 types of Overloading -


1) Operator Overloading
2) Method Overloading
3) Constructor 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

3)Local variables (Method Level Variables): declare variables inside a method


directly,
Local variables will be created at the time of method execution and destroyed once
method completes
Local variables of a method cannot be accessed from outside of method

Constructor Concept

- Constructor will execute only once per Object

You might also like