Midterm Review Flashcards
What is OOP?
Object-Oriented Programming - organizes software design around objects
What is abstraction?
Hiding the complex processes behind the program and only exposing what is necessary for the functionality of the user (ex. gas pedal in a car)
Define a class
A blueprint for creating objects (defines a set of data and functions)
Define an object
Is an instance of a class
Define instantiation
The process of creating an actual instance (or object) from a class
What is ADT?
Abstract Data Type - hides the internal details of the data structure and only provides the essential operations
Member functions
Functions that are defined within a class and operate on the data of objects created in that class (AKA methods)
Member variables
Variables define within a class
Method
A function that is defined with a class and operates on the objects of that class (AKA member function)
Access Specifiers
Control the visibility and accessibility of class members
Global
Variable that are defined outside of all functions and have a global scope
Inline
A small function that you tell the compiler to try to insert directly into the places where it’s called (instead of making a regular function call)
Constructor
A special member function that is automatically called when an object of a class is created
Destructor
A special member function that is automatically called when an object of a class is destroyed
Static
Something that is fixed or unchanging
Default Constructor
Initializes an object with no arguments
Default Parameter
A value that is automatically assigned to a function parameter if no argument is provided
Constructor Delegration
Allows for one constructor to call another constructor in the same class
Accessor Method
A member function in a class that retrieves the value (AKA getter)
Preprocessor Directive
A command that is processed by the preprocessor before the actual compilation of the code begins
Iostream Header File
Part of the standard library and provides functionality for input and output operations
Cin
Input for c++
Cout
Output for c++
Named Constants
Variables whose values are set at compile time and CANNOT be changed
Iomanip & How to Format Output
Provides facilities for manipulating the format of input and output streams
Class Declaration vs. Class Definition
A class declaration introduces the class name and its members. A class definition provides the complete details of the class, including the implementation of its member functions and the definitions of its member variables.
. operator
Used to access members (attributes and methods) of an object or structure
: operator
Used in class definitions to specify the base class and initialize it in the constructor of a derived class.
:: operator
Used to define the scope of a class, namespace, or enumeration
«_space;operator
Insertion operator (cout)
> > operator
Extraction operator (cin)
~ operator
Destructor operator
?: operator
Ternary Conditional Operator
, operator
Separator
sizeof operator
Used to determine the size (in bytes) of a data type or an object
-> operator
Used to access members of a class or structure through a pointer
& operator
Address
(type) operator
Type cast operator. It is used to convert a value from one type to another explicitly
- operator
Dereferences a pointer
What is the difference between syntax and semantics?
Syntax refers to the rules and structure that govern how code is written in a programming language. Semantics refers to the meaning or behavior associated with the syntactically correct statements in a programming language
Source Code vs. Object Code
Source code is the human-readable set of instructions written in a programming language (like C++, Python, or Java). Object code is the machine-readable code generated from the source code after it has been compiled or assembled
What is the role of the compiler?
Converts into machine code
What is the role of the linker?
Combines various pieces of compiled code into a single executable program