Concept of objects and classes Development of computer
Concept of objects and classes
Development of computer programs • Computer as such can understand only machine codes of ON and OFF. • Symbolic Assembly codes were used to represent machine codes. • High-level languages were developed to replace the assembly language. • Structured principle in programming was adopted. • Procedural programming approach focused on procedures.
Object-oriented programming • Object-oriented programming (OOP) deals with modular independent units to make them easier to maintain, extend and reuse. • OOP centers around the concept of objects.
Fundamental concepts Object • Object has q state q behaviour q identity AG 108
Class • Class is a blueprint or prototype that defines the common characteristics of objects of certain kind. • Object is an instance of a class. Class Object
Encapsulation • Class has an attribute of encapsulation, hiding the nonessential information. • Class has a method
Abstraction Ignoring the irrelevant details and concentrating on essential ones is class abstraction
Polymorphism is different interpretation of the same message by the objects and their responses. Response: Area= l x b Message: Find area Response: Area= (b x a)/2 Rectangle object Triangle object
Inheritence Class inherits certain attributes and behaviour from its super class.
Message with parameter Information is passed along with the message as parameters Find the volume of a cube message with a parameter 5 cm Find the volume of a cube with sides 5 cm. message 5 cm
The inheritance tree, or class hierarchy, can be of many levels. Living things Animals Mammals Plants Flowering Birds Non flowering
End
- Slides: 12