Advantages of OOP
1.Provide solutions to real life problems
2. Code re-usability
3. Loose coupling
4. Easy understanding and maintainability
5. Nouns are the properties of objects or that which describes the objects
6. Verbs performs an action
Encapsulation
1. Binding the data and the code that acts on the data as a single unit.
2. An encapsulated code will provide easy access
3. Does n't have any side affects to other parts of the application
4. Hides the complex implementation details from the users
5. Once an object is created no body needs to know its implementation details in order to use it. But in old programs they need to know the implementation details.
6. Helps with loose coupling.
7. The variables of a class is hidden from other classes and they can only be accessed by methods.
8. Only the methods are accessible to the outside world.
example is HashMap - People knows that hashmap is used to store data as key value pairs. But no body knows how data is really stored.
Inheritance
1. Mechanism where an object acquires some/all properties of another objects.
2. The inherited class is called the subclass and the other class is called the Base class
3. Inheritance is a compile time feature
4. A super class can have any no of subclasses but a sub class can have only one super class.The reason being java does not support multiple inheritance
5. The super class, sub class have a "IS-A" relationship.
6. The derived class can access the public and protected members and methods of the parent class.
7. Multi level Inheritance - Class C inherits from class B and Class B inherits from Class A
8. Hierarchical Inheritance - A parent class will have more than one child classed
9. Hybrid inheritance or multiple inheritance is possible in java by Interfaces.
1.Provide solutions to real life problems
2. Code re-usability
3. Loose coupling
4. Easy understanding and maintainability
5. Nouns are the properties of objects or that which describes the objects
6. Verbs performs an action
Encapsulation
1. Binding the data and the code that acts on the data as a single unit.
2. An encapsulated code will provide easy access
3. Does n't have any side affects to other parts of the application
4. Hides the complex implementation details from the users
5. Once an object is created no body needs to know its implementation details in order to use it. But in old programs they need to know the implementation details.
6. Helps with loose coupling.
7. The variables of a class is hidden from other classes and they can only be accessed by methods.
8. Only the methods are accessible to the outside world.
example is HashMap - People knows that hashmap is used to store data as key value pairs. But no body knows how data is really stored.
Inheritance
1. Mechanism where an object acquires some/all properties of another objects.
2. The inherited class is called the subclass and the other class is called the Base class
3. Inheritance is a compile time feature
4. A super class can have any no of subclasses but a sub class can have only one super class.The reason being java does not support multiple inheritance
5. The super class, sub class have a "IS-A" relationship.
6. The derived class can access the public and protected members and methods of the parent class.
7. Multi level Inheritance - Class C inherits from class B and Class B inherits from Class A
8. Hierarchical Inheritance - A parent class will have more than one child classed
9. Hybrid inheritance or multiple inheritance is possible in java by Interfaces.
No comments:
Post a Comment