Nothing should be wrong with that code you have given. The only issue would be if you didn't have a private section in the "demo" class because there would be nothing to inherit. Other than that possibility, this is a perfectly error-free derived class definition.