Smart-Notes 45
Smart-Notes 45
The concept is built around procedures, which are routines or functions similar to those in
functional programming.
In POP, there is no security feature allowing one program to access another program's
information, demonstrating the absence of access modifiers.
Object-Oriented Programming (OOP) emphasizes data security and the concept of access
modifiers unlike POP.
C++ is an example of an OOP language, where programs are divided into objects rather
than functions.
Key components of OOP include classes, which serve as templates for objects, and
objects, which are instances of those classes.
For example, a class named "Fruit" can have objects like "Apple," "Banana," and "Mango."
Benefits of OOP include faster and easier execution of programs and a clearer structure
for program development.
It promotes the DRY (Don't Repeat Yourself) principle, enhancing code maintainability,
modification, and debugging.
Applications of OOP span across User Interface design, Real-Time Systems, Simulation,
Object-Oriented Databases, AI Systems, Neural Networks, and Office Automation systems.
Introduction to C++
C++ utilizes stream operators for input and output operations: the insertion operator `<<`
for output and the extraction operator `>>` for input.
The `cout` object is used with the insertion operator, while the `cin` object is used with the
extraction operator.
Example: `cout << "hello world"` demonstrates using the insertion operator to output text.
Tokens in C++
C++ specifically includes additional keywords such as `asm`, `bool`, `class`, and
`const_cast`, among others.
Identifiers in C++
They must begin with a letter or an underscore and can consist of letters, digits, and
underscores.
Example: In `void main() { int a; }`, `main` is a method name and `a` is a variable name.
Constants in C++
Constants are values that cannot be modified once defined; they represent fixed values
and are also known as literals.
Operators in C++
Operators are symbols that perform actions on variables and objects. The data on which
they act are called operands.
Example:
Data types specify the kind of data a variable can hold and dictate the memory allocated
for it.
Scope Resolution Operator `::`: Used to access global variables with the same name as
local variables.
Expressions in C++