CIS 22B - Notes for Thursday, 11/19

Announcements and Reminders

Recording

Comments on Exercise 9

What is wrong with this solution?

class Rectangle
{
    int length, width;
public:
    Rectangle(int l, int w);
    Rectangle operator+=(int value);
    int operator!();
friend ostream& operator<<(ostream& out, const Rectangle& obj);
};

Linked List

A linked list is a data storage technique that allows for a variable size container.  Linked lists typically consists “connected” nodes containing both data and one or more pointers.  The pointer(s) perform the connection to the “next” data item.  Common types of linked lists are single-ended (containing data and one next pointer) and double-ended (containing data and two pointers, next and previous).  Linked list containers are implemented in the C++ STL.

Example 

This is a multi-file solution

A multiple file application - demonstration

Source Files

Videos

Linked List video
Inserting a Node into a Linked List (concept)
Inserting a Node into a Linked List (code)