Chapter 5 - Object Oriented Programming : Computer Sci NEB Class 12
Chapter 5 - Object Oriented Programming : Computer Sci NEB Class 12
Learn Object Oriented Programming in Computer Science with comprehensive educational content from Padandas.
Documents 1 document
What is OOP?
OOP (Object-Oriented Programming) is a programming paradigm which focuses on data rather than procedure. It supports inheritance, so it is easy to reuse the code.
1. Programming Paradigms: Procedural, Structural and Object-Oriented
Differentiate between OOP and Structured Programming language (POP)
| OOP or Event-driven Program | POP or Structured Programming language |
|---|---|
| It uses a bottom-up development process. | It uses a top-down development process. |
| Class and object are the main ideas of OOP. | Function is the main idea of POP. |
| In OOP, focus is given to data rather than the procedure. | Focus is given to the procedure. |
| It includes features such as data abstraction, encapsulation, polymorphism, and inheritance. | It doesn't include such features. |
| New data and functions can be easily added when they are required. | Difficult to add new data and function. |
| Easy to reuse program code. | It doesn't have any mechanism for reusing program code. |
| Example of OOP language: C++, Java, C#, VB.Net, etc. | Example of a structured programming language: C, FORTRAN, COBOL, etc. |
2. Features of OOP
The features of OOP are as follows:
a. Class
A class is the collection of similar kinds of objects. A class is a data type. It is a template that unites member data and member functions. It is the prototype or model. It does not occupy memory location. A class is the well description of object.
Example: vehicle class
- Attributes (member data): Name, model, color, height
- Behaviours (member functions): start(), stop(), accelerate()
b. Object
An object may be a person, a place, a bank account, or any item that the program must handle. An object is an instance of a class. It gives life to a class. It occupies memory location.
c. Encapsulation
The wrapping up of member data and member function into a single unit is called encapsulation. The data is not accessible from outside of class. That is, data can be hidden making them private so that it is safe from accidental alteration. Only member function can access data of that class.
d. Data Abstraction
Abstraction is representing essential features of an object without including the background details or explanation. In OOP, abstraction is achieved by the help of class, where data and function are combined to extract the essential features only.
e. Inheritance
Inheritance is the process by which one class acquires the characteristics or property of another class. Inheritance is the process of creating new classes from the existing classes. New class is called derived class and existing class is called base class.
Inheritance is the property that allows the reuse of an existing class to build a new class.
Types of Inheritance
- Single Inheritance: Under this type of inheritance, there is a derived class with only one base class i.e., if a child class is built from only one parent class, then this type of inheritance is called single inheritance.
For example:Parent class↓Child class - Multi-level Inheritance (also written as multi inheritance): Under these types of inheritance, the derived class has several base classes. If a child class is built from two or more parent classes, then this type of inheritance is called multi-level inheritance.
For example:parent-class 1parent-class 2parent-class 3↓Child-class - Hierarchical Inheritance: Under this type of inheritance, the behaviour of one class may be derived by more than one class.
- Multiple Inheritance: Under this type of inheritance, the mechanism of deriving a class from another derived class.
f. Polymorphism
The word polymorphism is derived from the Greek word 'poly' which means 'many' and 'morph' which means 'form'. Polymorphism means "having many forms." Polymorphism means that the same functions may behave differently in different classes. Example of polymorphism in OOP is operator overloading, function overloading.
3. Advantages of OOP
- System can be easily upgraded from small to large systems.
- Software complexity can be easily managed.
- New data and functions can be easily added whenever necessary.
- Code reusability is possible due to the feature of inheritance.
- The data hiding concept helps the programmer to create secure programs.
Disadvantages of OOP
- Use of OOP is wastage of time in the case of small projects.
- Object oriented programs are much larger than other programs.
- Object oriented programs are slower because of their size.
- Programmers have to think differently.
- It needs lots of testing procedures.
About National Examinations Board
This content is part of Computer Science offered by National Examinations Board. This institution is committed to providing high-quality educational resources.
Frequently Asked Questions
This content is carefully structured to build understanding progressively, starting with fundamentals and advancing to more complex concepts.
Yes, once you have access, you can revisit this Object Oriented Programming content as many times as you need.
Practice exercises and examples are integrated throughout the content to reinforce your understanding of Object Oriented Programming.
Ready to Master Chapter 5 - Object Oriented Programming : Computer Sci NEB Class 12?
Continue your learning journey in NEB Class 12 Computer Science : Complete Notes , Q&A Solutions and Videos and explore more comprehensive educational content.