Object-Oriented Paradigm
Class:
Object:
- It is a programming paradigm based upon objects.
- It has both data and methods.
- It aims to incorporate the advantages of modularity and reusability.
- Objects are instances of classes.
- They are used to interact with one another to design applications and computer programs.
- The important features of object-oriented programming are −
- Bottom-up approach in program design.
- Programs organized around objects, grouped in classes.
- Focus on data with methods to operate upon the object’s data.
- Interaction between objects through functions or methods.
- Reusability (Inheritance) of design through the creation of new classes by adding features to existing classes.
- Examples: object-oriented programming languages: C++, Java, C#, Perl, Python, Ruby, and PHP.
Class:
- Class is a blueprint for an object.
- Class is a collection of similar kinds of objects.
- Class is a conceptual or logical or represent by template.
- No memory is allocated for a class.
- Class can exist without any objects.
- Exa. Fruit class, Vehicle class, Human class,
Object:
- Object is a real-time entity of a class.
- It is an instance of a class.
- An object is represented by states, behavior, and identity.
- The states are the data that represent an object.
- The behavior is the action of an object.
- The identity is a name that is uniquely represented by JVM.
- Each object needs a space in memory.
- Object cant exist without class.
- Exa.
- the state or attributes or characteristics of dog are color, size, weight, type
- the behavior of dog are wangling, barking, walking
- the identity of a dog is the name of dog
- These states and behaviors are called a member of the class.
- The states are represented by a variable.
- The behaviors are represented by function or methods.
Tags:
Java