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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:37:16+00:00 2026-06-15T12:37:16+00:00

Candidate::Candidate () { } Its not doing any thing. Not writing it as it

  • 0
Candidate::Candidate ()
{

}

Its not doing any thing.
Not writing it as it is can’t execute the line:

Candidate *list = new Candidate [10];

Why?

Error: no default constructor exists for the class "Candidate"
  • 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-15T12:37:18+00:00Added an answer on June 15, 2026 at 12:37 pm

    To allow your dynamic array allocation, new Candidate[10], a default constructor of Candidate must be available. That is, it must be able to take no arguments. If you provide any of your own constructors for Candidate, regardless of how many arguments they take, the implicit default constructor that is usually defined automatically by the compiler will not be defined. You therefore have to provide it yourself, even if its body is empty. See §12.1/5:

    A default constructor for a class X is a constructor of class X that can be called without an argument. If there is no user-declared constructor for class X, a constructor having no parameters is implicitly declared as defaulted (8.4).

    Your class would be fine as follows because the compiler will implicitly define a defaulted default constructor:

    class Candidate
    { }; // Compiler provides a default constructor
    

    But as soon as you give it any other constructor, the implicit default constructor is not provided any more:

    class Candidate
    {
     public:
      Candidate(int x);
      // A user-defined constructor is provided so the default constructor
      // must be defined explicitly
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I create a new project in the Visual Studio 2010 Release Candidate, for
I'm writing a Java program that requires its (technical) users to write scripts that
I am using XeTeX 3.1415926-2.2-0.9997.4 (part of TeX Live 2010). One of its new
I have a Candidate entity, with some associations exampled below. I have a view
Based on an answer from a candidate I have a confusion regarding the functioning
I'm working with the the Release Candidate of Visual Studio 2010 using Wf4 to
I am trying to figure out if XUL is a good candidate for GUI
I have a data storage requirement which is an excellent candidate for single instance
I just opened some old code in the current Eclipe Juno Release Candidate and
I am currently evaluating message queue systems and RabbitMq seems like a good candidate,

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.