Sockets class hierarchy in C++ (TCP and UDP)