O'Reilly logo

C++ Multithreading Cookbook by Milos Ljumovic

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Linked list, queue, and stack examples

The following example demonstrates the OOP usage of a linear linked list that can contain any generic type T. The idea behind this example is to show inheritance usage as a model for the relation that "B is a kind of A".

A linear list is a structure of linearly arranged elements in which we know that the first element links to the second, the second element links to the third, and so on. Basic operations with a linked list are insert element (PUT) and obtain element (GET). A queue is a linear list where the elements are arranged in order so that what enters a queue first gets out first, in other words, FIFO—First In First Out. Therefore, when you get an element, it is obtained from the top of the list, and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required