0% found this document useful (0 votes)
2 views11 pages

OOP Using CPP

Uploaded by

prajakta bujare
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views11 pages

OOP Using CPP

Uploaded by

prajakta bujare
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Object-Oriented Programming Using C++ - Unit 1 Notes

Page 1: Introduction
A program is a set of instructions given to a computer to perform a task.

Programming is the process of writing these instructions.

Real-life analogy: A recipe tells a cook exactly how to prepare a dish, just as a program tells a
computer what to do.

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }
Page 2: POP
Procedure Oriented Programming divides a problem into functions.
Features: Top-down approach, focus on functions, shared data.
Advantages: Simple for small programs.
Limitations: Difficult to manage large software.

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }
Page 3: OOP
Object-Oriented Programming organizes software around objects.
Features: Objects, Classes, Encapsulation, Abstraction, Inheritance, Polymorphism.
Advantages: Reusability, Security, Easy maintenance.

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }
Page 4: POP vs OOP
POP: Function-centric, top-down.
OOP: Object-centric, bottom-up.
POP shares data globally; OOP protects data using encapsulation.

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }
Page 5: Class and Object
Class is a blueprint.
Object is a real instance.
Example: Car blueprint -> actual car.

class Car { public: void start(){} };

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }
Page 6: Encapsulation & Abstraction
Encapsulation binds data and methods.
Abstraction hides unnecessary details.
ATM example: User sees options, not internal banking logic.

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }
Page 7: Inheritance
Inheritance allows one class to acquire properties of another.
Example: Vehicle -> Car, Bike.
Benefits: Code reuse and easier maintenance.

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }
Page 8: Polymorphism
Polymorphism means one interface with many forms.
Compile-time: Function overloading.
Run-time: Function overriding using virtual functions.

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }
Page 9: Applications
Applications include banking, hospital management, flight reservation, e-commerce, games,
education systems, library management.

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }
Page 10: Summary & Viva
Key terms: Program, POP, OOP, Class, Object, Encapsulation, Abstraction, Inheritance,
Polymorphism.

Viva:
1. What is a class?
2. Difference between class and object.
3. Advantages of OOP.
4. Explain inheritance.

Simple C++ Example:


#include <iostream>
using namespace std;
int main(){ cout<<"Hello OOP"; return 0; }

You might also like