Notes – Introduction to C++
C++ is a powerful, high-performance programming language that supports both procedural and object-oriented programming (OOP).
It is widely used in system programming, game development, embedded systems, and real-time applications.
Origin of C++
- Developed by Bjarne Stroustrup in the early 1980s at Bell Labs
- Initially called “C with Classes“
- Later renamed to C++, where
++symbolizes an enhancement over C
Features of C++
| Feature | Description |
|---|---|
| Object-Oriented | Supports classes, objects, inheritance, polymorphism |
| Compiled Language | Code is compiled into machine code before execution |
| Platform Independent | Code can be compiled on different operating systems |
| Low & High-Level | Combines low-level memory control with high-level features |
| Strong Type Checking | Reduces runtime errors through compile-time checks |
How is C++ Different from C?
| Aspect | C | C++ |
|---|---|---|
| Programming | Procedural | Multi-paradigm (OOP + Procedural) |
| Data Handling | Uses functions only | Supports classes and objects |
| Encapsulation | Not supported | Fully supported |
| Code Reuse | Limited | Supports inheritance |
Applications of C++
- Operating systems and device drivers
- Embedded systems
- Game engines and 3D graphics
- Financial and banking software
- Real-time simulations
Sample Hello World Program
#include <iostream>
using namespace std;
int main() {
cout << "Hello, C++!" << endl;
return 0;
}
Explanation:
#include <iostream>โ used for input/outputmain()โ starting point of executioncoutโ prints output to screenreturn 0;โ ends the program
