I guess the answer is... It depends...
You can for instance create a class to address a particular problem, and then create a simple app in which you test your class, and after you are happy with the class behaviour, include it in your larger project, either as a class or compiled into a library.
But you cannot set or make a class that already is part of a large project as test code.