Professional Documents
Culture Documents
Object Notes1
Object Notes1
Tip: The "Don't Repeat Yourself" (DRY) principle is about reducing the
repetition of code. You should extract out the codes that are common for the
application, and place them at a single place and reuse them instead of
repeating it.
When the individual objects are created, they inherit all the variables and
methods from the class.
Class 2: created obj of class one and using dot(.) operator we inherit the
methods
Example:
Class Fruits
Object:
Apple,mango etc
Class Car:
Object:
Maruti,BMW,AUDI
Example:
Encapsulation:
Capsule:
Inheritance:
Polymorphisam: overloading and overriding
Abstraction:
Core Object orientated Programming concept.
Process of hiding the internal data and implementation from the outer world.
Two Type:
1. Data Abstraction
2. Process Abstraction
Process Abstraction:
The abstract Keyword is a non-access modifier used for classes and methods.
Abstract Class-Its a restricted class that cannot create object.
1.An Abstract class can have abstract method and non abstract method
Encapsulation:
name=null;
Roll no:0;
name=null; Roll no:0;
name=null;
Constructor:
A constructor is a special method that is used to initialize objects.
It will have same name as Class Name.