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

  • SEARCH
  • Home
  • 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 7966941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:33:59+00:00 2026-06-04T06:33:59+00:00

I am implemented a class for Weighting scheme and have created 4 constructor in

  • 0

I am implemented a class for Weighting scheme and have created 4 constructor in the class with different number of parameters.when i try to invoke the constructor with parameter of a particular constructor then also the default constructor with no parameters is called.I am unable to understand why such this is happening .

Definition of constructor:

593     UnigramLMWeight(double param_log_,int select_smoothing_,double param_smoothing1_,double param_smoothing2_)
594         : select_smoothing(select_smoothing_), param_log(param_log_), param_smoothing1(param_smoothing1_),
595           param_smoothing2(param_smoothing2_)
596         {

Calling of constructor:

 79     enquire.set_weighting_scheme(Xapian::UnigramLMWeight(double(322.0),int(2),double(2000.0),double(2.0)));

But i have checked the values which are set are from default constructor.

can any one help me why this default constructor is called or is it every time default constructor is called after parametric constructor or the parameters are casted to some other type and constructor try to find such constructor but is unable to find such constructor and calls default constructor finally.

Code of set_weigthing scheme is :

 926 Enquire::set_weighting_scheme(const Weight &weight_)
 927 {
 928     LOGCALL_VOID(API, "Xapian::Enquire::set_weighting_scheme", weight_);
 929     // Clone first in case doing so throws an exception.
 930     Weight * wt = weight_.clone();
 931     swap(wt, internal->weight);
 932     delete wt;
 933 }

Do the set_weighing scheme set method calls clone function,do this is root couse of problem when it clones default constructor is called,is it so ?
Can that be reason ?

  • 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-04T06:34:00+00:00Added an answer on June 4, 2026 at 6:34 am

    When you make a copy of the object (clone?) copy constructor gets called.
    Seems that you have not implemented a custom copy constructor so the default one generated by compiler is called instead.

    UnigramLMWeight(const UnigramLMWeight& copy_from)
    {
    // implement copy here
    }
    

    http://login2win.blogspot.com/2008/05/c-copy-constructor.html might be helpful

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

Sidebar

Related Questions

I have implemented a class that extends System.Timers.Timer object. When I then save the
I'm trying a more object oriented approach with javascript and have implemented a class
I have implemented a LoginAccess class that prompts the user to enter their active
I have a singleton implemented like this: class Test123(object): _instance = None def __new__(cls,
I have a view in Eclipse (implemented by a class which extends org.eclipse.ui.part.ViewPart )
I have the following Strategy Pattern implemented: public abstract class RetrievalStrategy { public abstract
I have a service class implemented in Java 6 / Spring 3 that needs
I have an overloaded << operator from my reckful class implemented as follows: ostream&
I have implemented a class string, similar to std::string one. I have a problem
I have two implemented classes: class DCCmd : public DCMessage class DCReply : 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.