Basic Concepts of Object-Oriented Programming

Only available on StudyMode
  • Download(s) : 83
  • Published : September 8, 2012
Open Document
Text Preview
Basic Concepts of Object-Oriented Programming
1. Classes 2. Objects 3. Data abstraction 4. Data encapsulation 5. Inheritance 6. Polymorphism 7. Dynamic Binding 8. Message Passing

Student
DATA Name DOB Marks …. FUNCTIONS Total Average Display ….

Classes The entire set of data and code can be made as a user-defined type with the help of a class. Once a class has been defined, we can create any number of objects belonging to that class. A class gives a structure of what an object of its type will have. For example, consider, to represent students’ mark details, we can form the class as: Objects Objects are basic run-time entities which represent a person, a place or any item that the program must handle. Programming problem is analyzed in terms of objects and the nature of communication in between them. In other terms, objects are the runtime entities of a class. For example, the object for Student class can be created as follows: Student st1; st1 is the runtime entity of Student and it will have the data members Name, DOB and marks and the functions Total, Average and Display can be used by st1 to calculate

the mark details present in st1. Data Abstraction & Encapsulation The wrapping up of data and functions into a single unit is called as encapsulation. The data is not accessible to the outside world and those functions which are wrapped in the class can access it. Abstraction refers to the act of representing essential features without including the explanations. Since the classes use the concept of data abstraction, they are known as Abstract Data Types. Inheritance Person Attributes: Name Age Gender Student Attributes: Marks Course Staff DATA Department Designation

Inheritance is the process by which objects of one class acquire the properties of another class. For example, a student as well as a staff is a Person. Both have some common properties. Inheritance allows the programmer to reuse defined properties. Polymorphism Polymorphism means the...
tracking img