There are two problems here. Firstly, you're trying to store input into a memory address that you never set. What's the value of the char pointer nameof? It could be pointing anywhere in the memory, because you never gave it a value, so you're going to store your input into some random memory somewhere. If you're lucky, the OS will spot it and crash your program with a segFault, If you're unlucky, you will trash your own data and you won't even know. This implies that you don't really know what a pointer is and how to use one. Please read this: http://www.cplusplus.com/articles/EN3hAqkS/
and this: http://www.cplusplus.com/articles/z186b7Xj/
The second problem is that you created a pointer named nameof, and then you tried to create an object of type testclass, also named nameof. If you have two variables with the same name, how would the compiler know which one you meant? You cannot have two variables with the same name.