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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:28:26+00:00 2026-05-20T22:28:26+00:00

I require help with respect to class construction. In my class, I have used

  • 0

I require help with respect to class construction. In my class, I have used a copy constructor and operator= to prevent the compiler from creating them. In my main program, when I try to create an instance of the class, I get an error saying “No default constructor exists for the class”.

What could be the problem?

This is a snippet of my code.

class netlist {
    netlist(const netlist &);
    netlist &operator=(const netlist &);
    std::map<std::string, net *> nets_;
}; // class netlist

In my main function I am using:

netlist nl;

This is where I get the error. I am providing the copy constructor declaration, so they should not be a problem.

I would appreciate any help with this. Thanks in advance.

  • 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-05-20T22:28:27+00:00Added an answer on May 20, 2026 at 10:28 pm

    There are two problems with the code –

    1. class members are private by default.
    2. "I get an error saying "No default constructor exists for the class" ".

    Because if any kind of constructor is provided as a part of class declaration( netlist class has a copy constructor in this case), default constructor( i.e., constructor with no arguments ) is not provided by compiler.

    netlist nl;  // And this invokes call to the default constructor and so
                 // the error
    

    netlist.h

    class netlist {
    
    public: // Added
        netlist(); // This just a declaration. Should provide the definition.
        netlist(const netlist &);
        netlist &operator=(const netlist &);
        std::map<std::string, net *> nets_;
    }; // class netlist
    

    netlist.cpp

    netlist::netlist()
    {
           // .....
    }
    
    // Other definitions
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You will have to get.class.php for giving help. Working case(index.php spaghetti): <?php require_once 'classes/get.class.php';
I think I might have greatly misunderstood the usage of gluperspective() and require help.
I require help with a random number generator I am creating. My code is
I require help with a small Java problem I am having. I have an
I am just learning about app.config in respect of creating custom sections. I have
Hi I am a newbie in SQL and require help I have a parameterized
I require some help creating a navigation bar in jQuery, If you check out
I am creating a property search/ comparison website. I require help creating the mysql
I am writing some applications that require to have a Help Contents system tied
require 'digest' class UserMailer < ActionMailer::Base def receive_compliment(compliment) @recipients = #{compliment.receiver.email} @from = SERVICE_EMAIL

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.