CSCI 161 - Computer Science II
Spring 2025 Lectures
Course web site:
http://csci.viu.ca/~kabirh/courses/csci161/
Lectures
Sorting (Algorithms)
slides
Searching (Algorithms)
slides
Linked List (Data Structure)
slides
,
singlelinkedlist.cpp
,
doublelinkedlist.cpp
,
circularlinkedlist.cpp
Binary Search Tree (Data Structure)
slides
,
binarysearchtree.cpp
C++ Function Overloading and Template Function
slides
,
Example Code
,
Tutorial1
Tutorial2
Object and Class Basics
Basic Concepts
,
C++ Concepts
Member Variables and Member Functions
Example Code
Implicit Default Constructor and Implicit Default Destructor functions added by Compiler
Example Code
Regular Constructor and Regular Destructor functions defined by Developer
Example Code
Constructor Overloading
Example Code
Importance of Overloaded Explicit Default Constructor
Example Code
Explicit Destructor to avoid Memory Leak
Example Code
Const Member Function and Const Object
Example Code
Class Prototype and Member Function Implementation Outside Class Body
Example Code
Static Member Variables and Static Member Functions
Example Code
Friend Function
Example Code
Friend Class
Example Code
Modular Programming
Specifications:
rectangle.h
,
circle.h
,
cylinder.h
Implementations:
rectangle.cpp
,
circle.cpp
,
cylinder.cpp
,
main.cpp
Special Member Functions: Copy Constructor, Copy Assignment, Move Constructor, and Move Assignment
slides
,
Example Code
,
Example Code
,
Example Code
,
Example Code
Operator Overloading
slides
,
Using Member Function
,
Using Friend Function
,
Using both Member and Friend Functions
,
Tutorial
Template Class
Example Code
Inheritance Basics
slides
,
Example code
,
Tutorial
Inheritance Use Cases
Generalization
slides
,
Example Code 1
Adaptation
slides
,
Partially Adapted
,
Completely Adapted
Inheritance and Runtime Polymorphism (
virtual functions
,
pure virtual functions
,
abstract class
)
slides
Example Code 1 (No Runtime Polymorphism)
,
Example Code 1 (No Runtime Polymorphism) Output
,
Example Code 1 (No Runtime Polymorphism) PDF
Example Code 2 (Runtime Polymorphism)
,
Example Code 2 (Runtime Polymorphism) Output
,
Example Code 2 (Runtime Polymorphism) PDF
Example Code 3 (Abstract Class)
,
Example Code 3 (Abstract Class) Output
,
Example Code 3 (Abstract Class) PDF
Example Code 4 (Abstract Class)
,
Example Code 4 (Abstract Class) Output
,
Example Code 4 (Abstract Class) PDF
Final Function and Final Class (To block extension in Inheritance Hierarchy)
Example Code
Abstract Data Type (ADT)
slides
Example Codes
Abstract Class (ADT)
StackADT.h
First Implementation Class (CDT)
ArrayStack.cpp
Second Implementation Class (CDT)
LinkedListStack.cpp
Using First CDT
ArrayStackMain.cpp
Using Second CDT
LinkedListStackMain.cpp
Choosing First or Second CDT at Runtime
StackADTMain.cpp
Exception Handling
No Error Handling
,
Error Handling
,
Exception Handling
,
Exception Handling with Costomized Exception
,
Tutorial
,
Exception Standard Library
C++ Namespaces
slides
Multiple Inheritance and Diamond Problem (
virtual base class
)
Class Diagram
Sepecifications:
person.h
,
employee.h
,
student.h
,
teachingassistant.h
Implementations:
person.cpp
,
employee.cpp
,
student.cpp
,
teachingassistant.cpp
,
main.cpp
Resources
Useful Prerquisite concepts.
Illustration of Function Calls by Value and by Reference
C/C++ Pointer and Dynamic Memory Allocation (new and delete)
slides
,
Cracking C++ Pointer and Dynamic Memory Allocation
C/C++ Function Pointer
Tutorial
C Structure
slides
C++ Basic I/O and File I/O
slides
Copying file example code
Function Call's Run-time Steps and Memory Layout (Call Stack Frames)
C++ Tutorials:
W3Schools.com
learncpp.com
cplusplus.com
C++ References:
cplusplus.com
Git Reference