Quote Originally Posted by franco.amato View Post
Wysota but if I declare the struct in a .h file outside the class, how I have to change the code of the getMyStruct?
Try to find some good books about c++ and object oriented programming.

Qt Code:
  1. struct MyStruct
  2. {
  3. MyStruct() : a(0), b(0) {}
  4. int a;
  5. int b;
  6. };
  7.  
  8. class MyClass
  9. {
  10. public:
  11. MyClass();
  12. ~MyClass();
  13.  
  14. MyStruct *getMyStruct();
  15.  
  16. private:
  17. MyStruct *mystruct;
  18. };
  19.  
  20. MyClass::MyClass()
  21. {
  22. mystruct = new MyStruct;
  23. }
  24.  
  25. MyClass::~MyClass()
  26. {
  27. delete mystruct;
  28. }
  29.  
  30. MyStruct *MyClass::getMyStruct()
  31. {
  32. return mystruct;
  33. }
To copy to clipboard, switch view to plain text mode