Using C++ types and logic