Note that there are some explanatory texts on larger screens.

plurals
  1. POFailed to create object of derived class in some cases
    primarykey
    data
    text
    <pre><code>// Base Class class Base { public: void RegisterWithServer(); // some more functions protected: Base(std::string aTestName, std::string aServerName); ~Base(); private: std::string mString; std::string mServerName; yami::agent mYAMIAgent; }; // Base Class constructor Base::Base(string aTargetName, string aServerName): mString(aTargetName), mServerName(aServerName) { // my debug statment cout &lt;&lt;" we are in Base Class constructor"&lt;&lt; std::endl; cout &lt;&lt;" in normal case we get this debug statement but in case of crash it doesnt reach till here I suppose "&lt;&lt; endl; } // DerivedClass class derivedClient: public Base { public: derivedClient(std::string aceptedString); virtual ~derivedClient(); private: std::string mServerAddress; std::string mServerName; }; // constructor derivedClient::derivedClient(string aceptedString): Base(aceptedString, "ServerTest"), mServerAddress(aceptedString), mServerName ("ServerTest") { cout &lt;&lt;" in normal case we get this debug statement but in case of crash it doesnt reach till here I suppose "&lt;&lt; endl; RegisterWithServer(); // call base class function }; // in some other function in different file some function() { ..... ..... try { if( meet certain condition) { ...... ...... cout &lt;&lt;" the code reached till here" &lt;&lt; std::endl; derivedClient dClient("192.168.2.110");// problem ?? cout &lt;&lt;"in case of crash below lines are not printed nor any message is printed from both constructors "&lt;&lt; std::endl; } } catch( const yami::yami_logic_error &amp; aYamiException) { cout &lt;&lt; "error: " &lt;&lt; aYamiException.what() &lt;&lt; endl; } } </code></pre> <p>Hi Guys,<br> I am fixing the bug in the existing software .<br> Problem -> after some times the software stops responding . What I have done -> I have traced the problem and found that when software crashes it fails before the object creation from dervived class. </p> <p>The derived class calls dervived constructor and base constructor. I have added debug statement and found nothing is printed on debug. </p> <p>I want to know why the code is not even going into derived class and base class ? is it possible that private variables have not been initialsed properly ? </p> <p>Please throw some comments on sample code.<br> Thanks and regards,<br> Sam </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload