Object Oriented Programming
By Sarfraz Raza
Teacher Assistants:
Aimen, Maryam, Usman, Omer, Abdullah Mushtaq, Abdullah Nezami, Faraz
Teacher Assistants:
Aimen, Maryam, Usman, Omer, Abdullah Mushtaq, Abdullah Nezami, Faraz
Average vs Genuine Programmer
Memory needed for Chess Design
Convention used for Black and White pieces
Improving readability of the code
Two dimensional array for chess Board
Every game is a loop
Initialization
Print Board
Turn Message
Source Piece Select
do while loop
Is Valid Selection
Destination Piece Select
do while loop
Is Valid Destination
Write On Board
Turn Change
Chess Boot Camp Phase 1 - Video Lecture
Is horizontal/ vertical/ diagonal path functions
Is horizontal/ vertical/ diagonal path clear
Legality functions for each of the six pieces of chess
Chess Boot Camp Phase 2 - Video Lecture
Getting input through mouse click
Go to row column function
Highlight
Un-highlight
Check
Self Check
Check Mate
Stale mate
Save to file
Load from file
Undo move
Replay
Castling
Incorporating all functions in game loop
Chess Boot Camp Phase 3 - Video Lecture
Logical errors
Debugging an example erroneous program (Faulty Calculator I)
Where to apply the debug/ break point?
State of the program
Functions of Ctrl+F5, F5, Shift+F5, F10, F11, Shift+F11
Detailed debugging of Faulty Calculator I
Assignment 1: Debug Faulty Calculator I and II
Logic of subtracting numbers and carry
Right to left vs left to right subtraction
Using the subtraction logic to subtract two dates
Age Calculator
Valid Date function
Valid Current Date function
Calculate Age function
Debugging Age Calculator program
Quiz 1: Two sum problem
Reference to a variable
Pointers
& operator (creating reference, getting address)
* operator (creating pointer, dereferencing)
Name of array is a pointer
Size of pointer
Memory addressing and memory maps
Segments of memory
Stack Segment
Heap Segment
Code Segment
Global Segment
Four types of pointers
Allocating array size at run time
Allocating memory in heap
new keyword
Looking into changing the size of dynamic array
Memory maps
Assignment discussion
Segregation Problem
Electronic Voting
Loading parties from file
Maintaining votes of each party
Printing in the required format
Dynamic Array
Creating 2D Dynamic arrays
Memory Diagram of 2D Dynamic Array
Example problem (Binary Conversion) explained
Integer to Binary Conversion function
Main flow of the program
Implementation in C++
Loading students records without structs
What are structures?
Making structs in C++
User defined data type
Size of struct in bytes
Loading student records from file in array of struct 'Student'
Printing student array
Sorting records on basis of different attributes
Position struct
Snake struct - an array of Positions, size, score, snake symbol
Movement of snake
Game over condition
kbhit
Starting the main flow of the game
Initialization function
Printing snake
Starting implementation in C++
Display snake
The main loop
Change direction function
Move snake function
Food display
Food capture
Snake expand
Valid food
Regenerate food
Polynomial Struct
Load
Get Coefficient
Addition
Subtraction
Evaluate
Derivative
Integral
The Story of OOP
Charles Babbage and Ada Lovelace
The Start Of Programming
The Advent of Programming Languages
Current Era of Programming
Time Class
Public and Private Attributes
Setters and Getters
What is This pointer and How it works
Universal Time
Standard Time
Sets Class
Constructors
Destructor
IsPresent Utility Function
Load
Creating new objects in Switch Statement
Write in File
Intersection
Union
Complement
Disjoint
Equal Sets
Disjoint
Superset
Subset
Proper subset
Constructor
Destructor
Discussion of Chapter 9 from "C++ How To Program" by Deitel and Deitel 9th Edition
Use of #pragma once
Constructor
Default, Parametrized, Copy
Use + benefits of Member Initialization list
Exception Throwing
Try Catch
Quiz - Scenarios in which copy constructor gets called
Static and global variables
Destructors
Order in which constructors and destructors are called
Composition.
A detailed discussion of Composition from Deitel 9th Edition Book.
Static Variables.
How Static variables are not part of any Object?
Applications of static variables.
Static Functions.
How Static variables are not part of any Object?
Why we can't access class members (variables) in Static Function?
Benefits of Static Functions and variables.
Introduction to Friend Functions and Friend Class.
The Basic idea of notepad functionalities.
Discussion about How Windows notepad works?
Demo of Text Editor Project.
Loading recently made documents.
Opening password-protected documents.
Finding and highlighting the substring from the entire document.
Opening multiple documents at the same time.
Implementation of:
InsertCharacterAt_i (___); (function).
Receiving Arrow keys and implementing them on console.
Revision of Friend Classes and Functions.
Quiz on Composition and Friend classes.
Complete Discussion on required classes for the project:
Lines Class
Document Class
Text Editor Class
Explanation of all requirements of Text Editor Project.
Features
Functionalities
Complete Discussion on "Line Class" and all of its required functions from the given header file.