Study sheet: Introduction to C++ and OOP

Course Outline

  1. C++ Motivation and Course Framework
  2. Programming Languages and Abstraction
  3. Program Development Cycle
  4. C++ Development Toolchain
  5. C++ Fundamentals and Variables
  6. Object-Oriented Programming Principles
  7. Classes Objects and Memory
  8. Access Specifiers in C++

1. C++ Motivation and Course Framework

★ Must-know

  • C++ was created by Bjarne Stroustrup at Bell Labs in 1985 as an extension of C with object-oriented features.

📌 C++ combines near-assembly performance, manual memory control, object-oriented programming, generic programming, and procedural programming.

Further detail

  • C++ is used in:
    • operating systems
    • compilers
    • drivers
    • games
    • trading systems
    • robotics
    • embedded systems
    • performance-critical applications

Memory Hook

C++ performance and control → systems, games, embedded software

2. Programming Languages and Abstraction

★ Must-know

  • The abstraction levels are:
    • machine
    • assembly
    • low-level
    • mid-level
    • high-level
    • very high-level

Further detail

  • The listed programming paradigms are:

    • procedural
    • object-oriented
    • functional
    • scripting
    • declarative
    • logic
  • C++ was introduced in 1985 after C in 1972, and Python and Java were introduced in 1991 and 1995 respectively.

Memory Hook

Machine → Assembly → C/C++ → Java/Python

3. Program Development Cycle

★ Must-know

  • 🔄 The development stages are:
    1. problem definition
    2. algorithm design
    3. coding
    4. testing and debugging
    5. documentation

Further detail

  • Problem definition identifies requirements, inputs, outputs, and constraints and produces a problem statement.

  • Algorithm design uses flowcharts and pseudocode to produce an algorithm before coding begins.

Memory Hook

Define → Design → Code → Test → Document

4. C++ Development Toolchain

Key Concepts & Definitions

  • Compiler : translates high-level source code into machine code, checks errors, performs optimization, and can create an executable file

★ Must-know

  • 🔄 The compilation stages are:
    1. preprocessing
    2. compilation
    3. assembly
    4. linking

📌 A linker combines object files, resolves external references, and creates an executable, whereas a loader places the executable in memory and starts it.

Further detail

📌 Static linking copies libraries into the executable, whereas dynamic linking loads libraries at runtime and requires DLL or .so files.

Memory Hook

Source → Compiler → Object files → Linker → Executable → Loader

5. C++ Fundamentals and Variables

Key Concepts & Definitions

  • Variable : a named storage location in memory that holds a value that can change during program execution

★ Must-know

  • Variable naming rules require that a name:
    • start with a letter or underscore
    • contain letters, digits, and underscores
    • be case-sensitive
    • not be a reserved keyword
    • contain no spaces

📌 A local variable is declared inside a function or block, whereas a global variable is declared outside all functions.

Further detail

  • The presented primitive types are:
    • int
    • float
    • double
    • char
    • bool
    • void

6. Object-Oriented Programming Principles

Key Concepts & Definitions

  • Encapsulation : binds data and methods together while hiding internal implementation details

Essential Points

📌 Procedural programming focuses on functions and separates data from functions, whereas object-oriented programming combines data and methods in objects.

  • The four core OOP principles are:
    • encapsulation
    • inheritance
    • polymorphism
    • abstraction

Memory Hook

EIPA: Encapsulation, Inheritance, Polymorphism, Abstraction

7. Classes Objects and Memory

Key Concepts & Definitions

  • Class : a user-defined data type that encapsulates data members and member functions and serves as a blueprint for objects without allocating object memory
  • Object : an instance of a class that occupies memory and can be manipulated through the properties and behaviors defined by the class

★ Must-know

📌 The dot operator accesses members through an object, whereas the arrow operator accesses members through a pointer to an object and is equivalent to (*pointer).member.

📌 Objects allocated on the stack are destroyed automatically, whereas objects allocated on the heap with new require a matching delete to prevent memory leaks.

Further detail

📌 A member function defined inside a class is inline by default, whereas a member function defined outside the class separates its interface from its implementation using the scope-resolution operator.

Memory Hook

Class is the blueprint; object is the memory-resident instance

8. Access Specifiers in C++

Key Concepts & Definitions

  • Access Specifier : defines the visibility and accessibility of class data members and member functions from different parts of a program

Essential Points

  • Public members are accessible from inside the class, derived classes, and outside the class.

  • Protected members are accessible inside their class and derived classes but not from outside the class.

  • Private members are accessible only inside their class, and the default access specifier in a class is private while the default access specifier in a struct is public.

Memory Hook

public: everywhere; protected: class and children; private: class only

Synthesis Tables

Access Specifier Visibility

SpecifierInside classDerived classOutside class
publicYesYesYes
protectedYesYesNo
privateYesNoNo

Test your knowledge

Test your knowledge on Introduction to C++ and OOP with 23 multiple-choice questions with detailed corrections.

1. Who created C++ at Bell Labs in 1985 as an extension of C with object-oriented features?

2. Which combination best characterizes C++ as a programming language?

Take the quiz →

Review with flashcards

Memorize the key concepts of Introduction to C++ and OOP with 48 interactive flashcards.

Who created C++ and when?

Bjarne Stroustrup created C++ in 1985.

Where was C++ created?

At Bell Labs.

What programming paradigms does C++ combine?

Object-oriented, generic, and procedural programming.

See flashcards →

Similar courses

Create your own study sheets

Import your course and AI generates sheets, quizzes and flashcards in 30 seconds.

Sheet generator