Code from C and C++ class