I have a class like this:
Qt Code:
  1. class Class1
  2. {
  3. public:
  4.  
  5. Apple * apple();
  6.  
  7. private:
  8. QScopedPointer< QPointer<Apple> > m_apple;
  9. };
To copy to clipboard, switch view to plain text mode 

Apple is a QDialog.
How do I instantiate m_apple in apple()?
I tried the following but could not compile:
Qt Code:
  1. Apple * Class1::apple() {
  2. if (m_apple == 0) {
  3. m_apple->reset(new Apple());
  4. }
  5. return m_apple;
  6. }
To copy to clipboard, switch view to plain text mode