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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:04:57+00:00 2026-06-14T23:04:57+00:00

Possible Duplicate: What is this weird colon-member syntax in the constructor? I’m trying to

  • 0

Possible Duplicate:
What is this weird colon-member syntax in the constructor?

I’m trying to understand what this kind of code means

Say I have this

class OptionStudent: public Student // derived class from Student class
{
    public:
        explicit OptionStudent(const std::string id = "12345678", 
                               const std::string first = "someone")
        : Student(id, first)
        {
             count_++;
        }
}

What is that colon after the “someone”): <– part called or mean for this constructor?
I know the constructor may be a little incorrect but I don’t know what this is called. I just copied my notes from what the instructor was writing on the board and didn’t understand it.
Something to do with the class or object remembering something?

  • 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-14T23:04:58+00:00Added an answer on June 14, 2026 at 11:04 pm

    It is the member initialization list. In this case, it calls the base class’s constructor with id and first as arguments. It could also provide initial values for non-static data members of your class (if you had any).

    Note that the semicolon after Student(id, first); is a syntax error and needs to be removed.

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

Sidebar

Related Questions

Possible Duplicate: What is this weird colon-member syntax in the constructor? I am looking
Possible Duplicate: What is this weird colon-member syntax in the constructor? I need to
Possible Duplicate: What is this weird colon-member syntax in the constructor? C++ initialization I
Possible Duplicate: What is this weird colon-member syntax in the constructor? Hi, I recently
Possible Duplicate: What is this weird colon-member syntax in the constructor? So I was
Possible Duplicate: What is this weird colon-member syntax in the constructor? I have the
Possible Duplicate: What is this weird colon-member syntax in the constructor? I am in
Possible Duplicate: what is this weird code notation mean I have previously asked this
Possible Duplicate: Weird java behavior with casts to primitive types Why does this code
Possible Duplicates: C++ weird constructor syntax Variables After the Colon in a Constructor What

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.