Functors In C++

Originally posted on PERPETUAL ENIGMA:
When you look at the word “functor”, the first thing that comes to mind is that it looks very similar to “function”. The word actually comes from a field called category theory, which is an abstract branch of mathematics. A category basically consists of objects that are linked to each…

Client-Server chat in C++ using sockets

In this tutorial, I’ll demonstrate a simple Linux socket program that uses sockets to create a chat between a client and server. Before you read further into this, I recommend reading up on Linux socket programming and a bit on the layers of the internet for background. As this program uses Linux system calls, again,…

Class Factory Pattern (C++)

What exactly is class factory? Let’s say you were to build a car dealership simulation/application. You have an purely abstract base class called Car (or Auto). You have a manager class called Dealership, that manages all aspects of the facility, such as clients, car inventory, employees, and records of transactions. Let’s also assume that this…

Dynamic Memory and Pointers in C

Originally posted on C Programming with Al Jensen:
One of the blessings (some would say curse) of C is the degree to which we are able to micromanage dynamic memory in C.  By allocating and deallocating memory dynamically our programs can execute with greater flexibility and efficiency. Liked lists and queues, for instance, would be…

Priority Queue Tutorial (C#, C++, Java)

What is a Priority Queue? An ADT whose primary operations of insert of records, and deletion of the greatest (or, in an alternative implementation, the least) valued record. Most often implemented using the heap data structure. The name comes from a common application where the records being stored represent tasks, with the ordering values based…