I created a DataThread class that doesn’t extend a Thread, but has one as a member variable.
Favor composition over inheritance, is a rule that I heard of, but I am thinking that the name of the class should be change, as to not mislead.
Is this true?
It’s not true.
The name of a class is part of its public interface. The user of a public interface doesn’t care how functionality is implemented, only that it is available. (Indeed, allowing the user to not care about the implementation is the entire point of writing a class.)
Therefore, as long as the class offers the kind of operation commonly present in a Thread class, it doesn’t matter whether internally this is done via delegation or inheritance. If your class is a drop-in replacement for a thread, by all means call it a name with “thread” in it.
1