Previous Lecture | lect04 | Next Lecture |
Code from lecture
https://github.com/ucsb-cs24-f19-nichols/code-from-class/tree/master/10-08
Topics
Lecture video
Video: https://www.youtube.com/watch?v=JL0E7ibQ2rc&feature=youtu.be
Written notes: https://1drv.ms/o/s!AlgIeD1urAgmgQlHpyss6qfDD-Xm
Code: https://github.com/ucsb-cs24-f19-nichols/code-from-class/tree/master/10-08/10-08-video
Linked Lists
- Linked lists as an ADT (implementation using classes)
Unit testing
-
We’ll go over some important guidelines related to unit testing
-
I suggest also reading this blog post about the best (and worst) practices for unittesting your code
Makefiles and unit testing
- We will split our implementation of linked list into three files - header file (contains only the class definition), source file (contains the implementation of the class methods - no main), test file - uses the ADT. (More practice on this in lab02)
- Write a simple Makefile to compile all the different programs written in class
Non member functions and friend functions
- If a non-member function is declared to be a friend of a class, it can access the private members of the class.
Operator overloading - Pages 63 - 80 in the book
Example from reading:
point p1, p2;
if (p1 == p2){
cout<<"Points are equal\n";
}
We will specifically discuss:
- Overloading binary comparison operators e.g. ==
- Overloading binary arithmetic operators e.g. +
- Overloading output and input operators e.g. » and «