Explain an object.An object is an entity that keeps together state and behaviors. For instance, a car encapsulates state such as red color, 900 cc etc and behaviors as 'Start', 'Stop' etc., so does an object.
An object is an instance of a class. If you consider “Dog” as a class, it will contain all possible dog traits, while object “German Shepherd” contains characteristics of specific type of dog.Define a class.A class represents description of objects that share same attributes and actions. It defines the characteristics of the objects such as attributes and actions or behaviors. It is the blue print that describes objects.What is Method? Method is an object’s behavior. If you consider “Dog” as an object then its behaviors are bark, walk, run etc.Why are classes important?A class is the fundamental entity in OOP. The functionality, data need to be well defined in a class. The need, flow and actual functionality is to be well defined, structured in a class first, without which OOP can not be done.Explain the desirable qualities of an object.An object must instantiate a well defined class. Using an object the following features should be adhered
Modularity: The operations / methods should be defined separately for each module of the software project. One of the objects’ features can be used by other object as a reusable component.
Information Hiding: The data about one object should exclusively belong to that object, which enables the individual modules focuses on specific functionality.
Re-usability of code: An object of one class should have the same functionality that of another. Same code could be usable by all objects of one class. There should not be mismatching of the functionality of one object to that of another.
|