Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7708115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:31:42+00:00 2026-06-01T00:31:42+00:00

// Base Class class Base { public: void RegisterWithServer(); // some more functions protected:

  • 0
// 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 <<" we are in Base Class constructor"<< std::endl;
        cout <<" in normal case we get this debug statement  but in case of crash  it doesnt  reach till here I suppose "<< 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 <<" in normal case we get this debug statement  but in case of crash it doesnt  reach till here I suppose "<< endl;

 RegisterWithServer(); // call base class function
};


 // in some other  function in different file

 some function()
{
    .....
   .....
   try
   {
    if( meet certain condition)
    {
         ......
         ......
          cout <<" the code reached till here" << std::endl;
         derivedClient dClient("192.168.2.110");// problem ??

          cout <<"in case of crash below lines are not printed nor any message is printed from both constructors "<< std::endl;

       }
    }

   catch( const yami::yami_logic_error & aYamiException)
   {
    cout << "error: " << aYamiException.what() << endl;
    }

}

Hi Guys,
I am fixing the bug in the existing software .
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.

The derived class calls dervived constructor and base constructor. I have added debug statement and found nothing is printed on debug.

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 ?

Please throw some comments on sample code.
Thanks and regards,
Sam

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:31:43+00:00Added an answer on June 1, 2026 at 12:31 am

    I’m would guess that the constructor for yami::agent throws an exception which is why all the couts are not being run. As Oli mentioned in the comments all member variables of a class will be constructed before the class constructor is entered so yami::agent::agent() will be run before Base::Base() is entered.

    Edit:

    If you have something like:

    class MyObject
    {
         yami::agent m_Agent;    
    public:
         MyObject::MyObject() { }
    };
    

    then m_Agent will get constructed using its default constructor which is declared as agent(const parameters & options = parameters());. As you mention, for some reason yami::agent::agent() throws an exception which could due to any number of reasons such as a network initialization error, invalid input parameters, etc….

    If you want to specify custom parameters to the yami::agent constructor you can do something like:

     yami::parameters& GetDefaultYamiOptions (void)
     {
          static yami::parameters options;
    
                /* The following are just some example parameters */
          options.set_integer(yami::option_names::connection_retries, 1);
          options.set_integer(yami::option_names::connection_retry_delay_spread, 10);
          options.set_integer(yami::option_names::tcp_nonblocking, true);
          options.set_integer(yami::option_names::file_nonblocking, true);
          options.set_integer(yami::option_names::tcp_connect_timeout, 1000);
    
          return options;
     }
    
     class MyObject
     {
          yami::agent m_Agent;    
     public:
    
         MyObject::MyObject() : m_Agent(GetDefaultYamiOptions())
         {
         }
     };
    

    What parameters you need may be different than what I use and the cause of the issue may not be even related to incorrect parameters. It could well be a low level networking error from the OS or even hardware.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have, for example, such class: class Base { public: void SomeFunc() { std::cout
Here is my code - #include<iostream> using namespace std; class base { public: void
I have a question, here are two classes below: class Base{ public: virtual void
using System; namespace random { interface IHelper { void HelpMeNow(); } public class Base
Assume some domain and view objects (that have no common base class) public class
I have a base class: class CBase { public: virtual void SomeChecks() {} CBase()
Wondering what the difference is between the following: Case 1: Base Class public void
base class class Drawer { public abstract void Draw<T>(T type); } derived class #1
Consider the following sample code: #include <iostream> using namespace std; class base { public:
#include<iostream> using namespace std; class Abs { public: virtual void hi()=0; }; class B:public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.