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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:40:36+00:00 2026-05-14T15:40:36+00:00

I have a set of code, which mimics a basic library cataloging system. There

  • 0

I have a set of code, which mimics a basic library cataloging system. There is a base class named items, in which the the general id,title and year variables are defined and 3 other derived classes (DVD,Book and CD).

Base [Items]

Derived [DVD,Book,CD].

The programs runs, however I get the following warnings, I’m not sure how to fix these.

>"C:\Program Files\gcc\bin/g++"  -Os -mconsole -g -Wall -Wshadow -fno-common mainA4.cpp -o mainA4.exe
In file included from mainA4.cpp:5:
a4.h: In constructor `DVD::DVD(int, std::string, int, std::string)':
a4.h:28: warning: `DVD::director' will be initialized after
a4.h:32: warning:   base `Items'
a4.h:32: warning:   when initialized here
a4.h: In constructor `Book::Book(int, std::string, int, std::string, int)':
a4.h:48: warning: `Book::numPages' will be initialized after
a4.h:52: warning:   base `Items'
a4.h:52: warning:   when initialized here
a4.h: In constructor `CD::CD(int, std::string, int, std::string, int)':
a4.h:66: warning: `CD::numSongs' will be initialized after
a4.h:70: warning:   base `Items'
a4.h:70: warning:   when initialized here
>Exit code: 0
  • 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-14T15:40:37+00:00Added an answer on May 14, 2026 at 3:40 pm

    When you declare member variables in a class, they’re initialized in the order you declare them. But you may write them in any order in your constructor’s initializer list. For example,

    struct foo {
       int a;
       int b;
    
       foo(): b(5), a(3) {}
    };
    

    will construct a and then b, even though it appears that you’re initializing them in the other order.

    The compiler issues a warning because you can trick yourself into writing incorrect code. For example,

    struct foo {
        int a;
        int b;
    
        foo(): b(5), a(b) {}
    };
    

    the value of a will be undefined.

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

Sidebar

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.