The problem
Most of the time, the class names defined by itself conflict with the class names of imported packages. The compiler cannot choose which one to use, and it will report an error.
Workaround (both work)
The same inheritance effect is achieved without changing the current class name.
1. Add namespace
//Original definition of the class: class People{ ... };
//Definition after adding namespace namespace Mynamespace{<!-- --> class People{<!-- --> ... }; }
//When inheriting class Student : public Mynamespace::People{ ... };
What is the namespace
2. Define aliases
class People{<!-- --> ... }MyPeople;
//When inheriting class Student : public MyPeople{ ... };