UPDATE: For all my blog readers who are requesting for more information on OOPS Concepts with example. Please refer the ‘More On Concepts’ section. It has more explanations with examples.
More On Concepts
What is an Object?
An object is a software bundle of related state and behavior.
Software objects are often used to model the real-world objects that you find in everyday life.Real-world objects share two characteristics: They all have state and behavior.
Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail).
Software objects are conceptually similar to real-world objects:
they too consist of state and related behavior.
An object stores its state in fields (variables in some programming languages)
and exposes its behavior through methods (functions in some programming languages).
Methods operate on an object’s internal state and serve as the primary mechanism for object-to-object communication.
Hiding internal state and requiring all interaction to be performed through an object’s methods is known as
data encapsulation — a fundamental principle of object-oriented programming
What Is a Class?
A class is a blueprint or prototype from which objects are created.
What Is Inheritance?
Inheritance provides a powerful and natural mechanism for organizing and structuring your software.
What Is an Interface?
An interface is a contract between a class and the outside world.
When a class implements an interface, it promises to provide the behavior published by that interface. What Is a Package?
A package is a namespace for organizing classes and interfaces in a logical manner.
Placing your code into packages makes large software projects easier to manage.