CSE OOP Lecture - OOP
CSE OOP Lecture - OOP
C++
Md. Monir Hossain
Lecturer, Dept. of CSE
• Window application
• Client-Server application
• Device drivers
• Embedded firmware etc
Object-Oriented Programming (OOPs)
1. Inheritance
2. Polymorphism
3. Encapsulation
4. Abstraction
Inheritance example
Polymorphism
Encapsulation
Abstraction
C++ Standard Libraries
Standard C++ programming is divided into three important parts:
• The core library includes the data types, variables and literals, etc.
• The standard library includes the set of functions manipulating strings,
files, etc.
• The Standard Template Library (STL) includes the set of methods
manipulating a data structure.
C++ Program!
#include <iostream>
using namespace std;
int main() {
cout << "Hello C++ Programming";
return 0;
}
C++ Variables
Variables are containers for storing data values.
int main() {
int x, y;
int sum;
cout << "Type a number: ";
cin >> x;
cout << "Type another number: ";
cin >> y;
sum = x + y;
cout << "Sum is: " << sum;
return 0;
}
C++ Data Types
int myNum = 5; // Integer (whole number)
float myFloatNum = 5.99; // Floating poi nt
number
double myDoubleNum = 9.98; // Floating point number
char myLetter = 'D'; // Character
bool myBoolean = true; // Boolean
string myText = "Hello"; // String
Basic Data Types
Data Type Size Description
float 4 bytes Stores fractional numbers, containing one or more decimals. Sufficient for
storing 6-7 decimal digits
double 8 bytes Stores fractional numbers, containing one or more decimals. Sufficient for
storing 15 decimal digits
C++ Operators
Operators are used to perform operations on variables and
values.
• Arithmetic operators
• Assignment operators
• Comparison operators
• Logical operators
• Bitwise operators
Differences between C and C++