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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:09:10+00:00 2026-05-18T10:09:10+00:00

This is probably a ridiculously easy question, but I’ve been searching around for the

  • 0

This is probably a ridiculously easy question, but I’ve been searching around for the answer for a while yet can’t seem to figure this out. I’m trying to initialize a constant variable constant pointer in a class. Here is the header file:

class Scheduler{
  public:
  Scheduler();
  explicit Scheduler( unsigned long * );

  private:
  const unsigned long *const thresh;

};

And here is the constructor for the class

Scheduler::Scheduler( unsigned long * threshold ):
  thresh(threshold)
{}

When I attempt to compile this code I run into this error:

scheduler.cpp: In constructor ‘Scheduler::Scheduler()’:
scheduler.cpp:3: error: uninitialized member ‘Scheduler::thresh’ with ‘const’ type ‘const long unsigned int* const’

Multiple sources online discussing constant member variables in constructors for member variables point to using initializer lists. I think I’m doing what I’m supposed to, but apparently it’s still no good. Can anyone see what’s wrong?

  • 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-18T10:09:10+00:00Added an answer on May 18, 2026 at 10:09 am

    You must initialize your constant member in the initialization list of ALL constructors. You are doing it only for the one with an argument. Do it for the default one too, and everything will be fne. In this particular case, either initialize your thresh with 0, or disable the default constructor.

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

Sidebar

Related Questions

This probably is a very very basic question but i can't seem to find
I've been working all day and I somehow can't get this probably easy task
This probably has been asked before but all I can find are questions regarding
This probably another silly question - but is there an MKMapViewDelegate method that can
This probably is one of my own mistakes, but I can't seem to find
I'm sure this is a rediculously easy question, but I just can't find the
This probably is a dummy question but I cannot find a clear indication. I
I know this probably has been asked before but I am having issues with
Im sorry for this probably dumm question, but I want to simply open modals
This probably sounds like a really dumb question, but here goes....Web Services, what the

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.