Search Results

Search found 2 results on 1 pages for 'oszkar'.

Page 1/1 | 1 

  • Why doesn't the C++ default destructor destroy my objects?

    - by Oszkar
    The C++ specification says the default destructor deletes all non-static members. Nevertheless, I can't manage to achieve that. I have this: class N { public: ~N() { std::cout << "Destroying object of type N"; } }; class M { public: M() { n = new N; } // ~M() { //this should happen by default // delete n; // } private: N* n; }; Then this should print the given message, but it doesn't: M* m = new M(); delete m; //this should invoke the default destructor

    Read the article

  • C++ Primer vs. Thinking in C++?

    - by Oszkar
    I've worked with C++ in the last few years but never went through a book covering all the basics. I've recently read Effective C++, but I feel it would be very important for me to read a more fundamental book as well. Which one would be more recommended? C++ Primer or Thinking in C++?

    Read the article

1