Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

shared_ptr

$
0
0

class myClass{
public: 
      myClass(); 
      ~myClass(){}
private: 
      std::shared_ptr<someClass> scObj;
};
myClass::myClass() : scObj(new someClass) //works{ 
      scObj = new someClass; //<< error 
      scObj(new someClass); //<< error
}


The initialization list after the : works, but for the purpose of satisfying my curiosity, I would like to know why the other initialization methods do not work.
Thanks for your help!


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>