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 8509273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:23:23+00:00 2026-06-11T03:23:23+00:00

This is very trivial, but Czech language (my native) doesn’t distinguish between implicit and

  • 0

This is very trivial, but Czech language (my native) doesn’t distinguish between implicit and default, so I am confused by some Czech translations what is the difference between implicit and default constructor or constructor call.

struct Test {
  Test(int n=0) { }
};

Can you describe in these terms what the following statements do?

  1. Test t1;
  2. Test t2();
  3. Test t3 = 3;
  4. Test t4(4);
  5. Test t5 = Test(5);
  • 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-11T03:23:25+00:00Added an answer on June 11, 2026 at 3:23 am

    The terms default and implicit, when talking about a constructor have the following meaning:

    • default constructor is a constructor that can be called with no arguments. It either takes no arguments or has default values for each of the arguments taken.

    • implicit constructor is a term commonly used to talk about two different concepts in the language, the

      • implicitly declared constructor which is a default or copy constructor that will be declared for all user classes if no user defined constructor is provided (default) or no copy constructor is provided (copy). That is, a class with no constructors declared by the user has one default constructor implicitly declared.

      • implicitly defined constructor is a implicitly declared constructor that is used (odr-used1 in the language and for which the compiler will provide a definition.

       

      struct test
      {
          test(int i = 0) { }
          // test(test const&) implicitly declared here
      };
      
      struct test2 { };      // implicitly declared: test2(), test2(test2 const&)
      
      int main()
      {
          test t;
      
          test copy(t);      // causes *definition* of the implicitly
                             // declared copy constructor
      
          test2 t2;          // causes *definition* of test2::test2()
      
          test2 copy2(t2);   // causes *definition* of test2::test2(test2 const&)
      }
      

    In simple terms, a constructor is default if it can be called with no arguments. A constructor is implicit(ly declared/defined) if it is not provided by the user but declared/defined.

    As of the specific cases:

    Test t1;
    

    Uses the default constructor, Test(int = 0), which is not implicit.

    Test t2();
    

    This is a strange quirk of the language, it declares a function that takes no arguments and returns a Test object.

    Test t3 = 3;
    

    This is called copy-initialization and is equivalent to the composition of an implicit* conversion from 3 to Test and copy construction of t3 from the result of the conversion. This will use the Test(int) constructor for the conversion, and then the implicitly defined (and declared) copy constructor. Note: the compiler can optimize away the copy, but it must verify that the copy constructor is available (access specifiers) and can be defined.

    Test t4(4);
    

    Uses the Test(int) constructor, which in this case is not acting as a default constructor.

    Test t5 = Test(5);
    

    Equivalent to the Test t3 = 3 case, with the only difference that the conversion from 5 to Test is explicit in this case. In this example it won’t matter, but if the constructor had been marked as explicit this line would compile while the t3 case would fail.


    *) Yet another use of implicit, in this case referring to the fact that the conversion from 3 to Test is not explicitly requested in the code. Compare this with t5 where the conversion is explicitly requested by the programmer: Test(5).

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

Sidebar

Related Questions

For sure this is very trivial math stuff for some of you. But: When
I fear this is a very trivial question. But I'm having some trouble getting
This might be something very trivial, but I am a novice with some Object-Oriented
This is probably very trivial but I can't for the life of me find
This is a very trivial problem but I can't seem to find a way
I know this is very trivial , but i have installed J2Me .I just
This must be very trivial, but I can't find it out: struct Test {
This is probably a very trivial question, but I haven't been able to find
I'm new and this is probably very trivial but I have the following method
I know this is very trivial but I can't seem to find the answer

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.