Hello everyone, this will be my very first thread. I am currently learning qt from tutorials and books. At some point, I implemented this class with Private
Implementation covered with QScopedPointer.

***1) Here is my MasterController class with a forward declaration of class "Implementation" with QScoped Pointer guards it.


Qt Code:
  1. class CMLIB_EXPORT MasterController : public QObject
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. explicit MasterController(QObject* parent = nullptr);
  7. ~MasterController();
  8.  
  9. cm::controllers::NavigationController* ui_navigationController();
  10.  
  11. signals:
  12. private:
  13.  
  14. class Implemantation;
  15. QScopedPointer<Implemantation> implementation;
  16. };
To copy to clipboard, switch view to plain text mode 

*** 2) Here is also my cpp file for MasterController class. Here we see previously declared Implemation class as well as constructor, deconstructor of Master Class.


Qt Code:
  1. class MasterController::Implemantation
  2. {
  3. public:
  4. Implemantation(MasterController* _masterController) : masterController(_masterController)
  5. {
  6. navigationController = new NavigationController(masterController);
  7. }
  8.  
  9. ~Implemantation()
  10. {
  11. }
  12.  
  13. MasterController* masterController;
  14. NavigationController* navigationController;
  15. QString welcomeMessage = "This is MasterController to Major Tom";
  16. };
  17.  
  18.  
  19. MasterController::MasterController(QObject* parent) : QObject(parent)
  20. {
  21. //implementation is a scoped pointer
  22. implementation.reset(new Implemantation(this));
  23. }
  24.  
  25. MasterController::~MasterController()
  26. {
  27. }
  28.  
  29. NavigationController* MasterController::ui_navigationController()
  30. {
  31. return implementation->navigationController;
  32. }
To copy to clipboard, switch view to plain text mode 


*** 3) Here is my Question: My private implemented Class (Implementation) has 3 members :
a- MasterController class that it lives on
b- Someother Navigation Class
c- A String

If my MasterController class comes to the end of scope , everythis is fine, all objects are deleted. From curiosity, i deleted Destructor from MasterController and i got following compile errors:

C:\Qt\5.14.2\msvc2017_64\include\QtCore\qscopedpoi nter.h:57: error: C2027: use of undefined type 'cm::controllers::MasterController::Implemantation '
c:\qtprojects\cm-learningqt\customermanager\cm-lib\source\controllers\mastercontroller.h:34: see declaration of 'cm::controllers::MasterController::Implemantation '
C:\Qt\5.14.2\msvc2017_64\include\QtCore\qscopedpoi nter.h:53: while compiling class template member function 'void QScopedPointerDeleter<T>::cleanup(T *)'
with
[
T=cm::controllers::MasterController::Implemantatio n
]

I would be pleased if someone explains what the problem is and why destructor is important here.
Thanks in advance