As you can guess, console commands and variables can be a huge aid in debugging while development by allowing you to view and modify game variables and behavior during runtime. They also improve the end user experience by providing more customizability with little effort from the developer. I'll ignore the aspects of drawing the log window and handling input, because these are tied up with how your game engine implements input and rendering. The sample application for this article is a simple MFC dialog which basically just shows how to use the console specific code. If you do need to look at how I've implemented the console in our project, then you can get the complete source code of our game engine at the link at the end of the article.
Lets consider console commands first of all.
When a user enters a console command, the Console class needs to execute the function its associated with which will optionally handle the parameters entered by the user. In order to accomplish this, the Console class needs to know the name of the command and it needs to know what function to call for that particular command. This is easy if the class which defines the console command registers it with the console class. The only things the class would need to provide to the console class would be the name of the command, and a callback mechanism to have the proper member function executed when the name is entered in the console. This would be easy in C, because you could simply pass a function pointer and have the console call that when needed.