C
C
C
OOP is a programming paradigm that organizes software design around data, or objects,
rather than functions and logic. An object combines both data and the methods that
operate on that data. This approach enhances modularity and code reuse, making it easier
to manage and scale software projects.
- **Encapsulation**: Bundles data and methods that operate on the data into a single unit
(class), which protects data integrity by restricting direct access and modification.
- **Inheritance**: Allows new classes to inherit properties and behaviors from existing
classes, promoting code reuse and creating a natural hierarchy.
- **Inheritance**: Facilitates the creation of new classes from existing ones, allowing the
new class to inherit attributes and methods from the base class.
- **C**: A procedural programming language known for its efficiency and control over
system resources. It focuses on functions and structured programming without the object-
oriented features.
- **Tokens and Identifiers**: Tokens are the smallest units of a program (keywords,
operators, literals, etc.), while identifiers are names given to variables, functions, and other
entities.
- **Variables and Constants**: Variables hold data that can change during program
execution, while constants hold fixed values that do not change.
- **Basic Data Types**: Include `int`, `char`, `float`, `double`, and more, which define
the type of data a variable can hold.
- **Streams**: Handle input and output operations. Examples include `cin` for input and
`cout` for output.
### 7. **Types of Operators in C++**
- **Arithmetic Operators**: Perform mathematical operations (`+`, `-`, `*`, `/`, `%`).
- **Relational Operators**: Compare two values and return a boolean result (`==`, `!=`,
`<`, `>`, `<=`, `>=`).
- **Logical Operators**: Perform logical operations on boolean values (`&&`, `||`, `!`).
- **Bitwise Operators**: Operate on bits and perform bit-level operations (`&`, `|`, `^`,
`~`, `<<`, `>>`).
- **Assignment Operators**: Assign values to variables and can include shorthand for
operations (`=`, `+=`, `-=`, etc.).
- **Conditional Operator**: Ternary operator (`?:`) that provides a concise way to perform
conditional assignments.
- **if-else Statement**: Executes one block of code if a condition is true and another block
if it is false.
- **switch Statement**: Selects one of many blocks of code to execute based on the value
of an expression.
- **do-while Loop**: Similar to `while`, but guarantees at least one execution of the loop
body before checking the condition.
- **for Loop**: Provides a compact way to iterate over a sequence with a specified number
of iterations.
- **continue Statement**: Skips the remaining code in the current iteration of a loop and
continues with the next iteration.
### 9. **Pointers and Structures**
- **Pointers**: Variables that store the address of another variable. They are used for
dynamic memory management, arrays, and function arguments.
- **Structures**: User-defined data types that group different types of variables under a
single name, allowing for more complex data models.
- **Inline Function**: A function whose code is directly inserted into the calling code to
reduce function call overhead.
- **Function Overloading**: Allows multiple functions with the same name but different
parameter lists, providing flexibility in function usage.
- **Classes**: Define the blueprint for creating objects, including data members and
member functions.
- **Member Functions**: Functions defined inside a class that operate on the class’s data
members.
- **Static Data Members/Functions**: Belong to the class rather than individual objects,
shared among all instances.
- **Friend Function/Friend Class**: Functions or classes that can access private and
protected members of the class, providing flexibility in class interactions.
- **Constructors**: Special functions that initialize objects when they are created. Can be
default (no parameters), parameterized (with parameters), or overloaded.
- **Unary Operators**: Overloading operators that operate on a single operand (e.g., `++`,
`--`).
- **Binary Operators**: Overloading operators that operate on two operands (e.g., `+`, `-`,
`*`, `/`).
- **Base Class**: The class from which other classes are derived.
- **Derived Class**: The class that inherits from the base class, gaining its properties and
methods.
- **Types of Inheritance**: Includes single (one base class), multiple (more than one base
class), hierarchical (one base class, multiple derived classes), and hybrid (combination of
types).
- **Abstract Class**: A class that cannot be instantiated and may contain one or more pure
virtual functions, serving as a base for other classes.
- **Virtual Functions**: Allow derived classes to override methods in the base class,
enabling dynamic method binding.
- **Pure Virtual Functions**: Make a class abstract, requiring derived classes to provide an
implementation.
- **Opening and Closing Files**: Use stream classes like `ifstream` for input, `ofstream`
for output, and `fstream` for both.
- **File Modes**: Define the way files are accessed (`ios::in` for reading, `ios::out` for
writing, `ios::app` for appending, etc.).
- **Functions for I/O Operations**: Methods to read from and write to files, such as
`read()`, `write()`, `getline()`, and file status checking functions.
- **List**: A doubly linked list that allows for efficient insertion and deletion at both ends.
This comprehensive description should give you a solid understanding of the fundamental
concepts and components of C++ and OOP.