Previous Lecture lect04 Before Slides lect04 Annotated Slides Next Lecture

Code from lecture

https://github.com/ucsb-cs24-s18/cs24-s18-lectures/tree/master/lec-04

Topics

gdb

Makefiles

The big four

Operator overloading - Pages 63 - 80 in the book

We will start with a basic implementation of the point class from Chapter 2. We will then augment the class with binary operator functions. By overloading certain operators like ==, we can now write code as shown below:

point p1, p2;
if (p1 == p2){
  cout<<"Points are equal\n";
}

We will specifically discuss:

  1. Overloading binary comparison operators e.g. ==
  2. Overloading binary arithmetic operators e.g. +
  3. Overloading output and input operators e.g. » and «

If time permits…

Review of pointers and dynamic memory allocation