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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:33:08+00:00 2026-05-27T00:33:08+00:00

Possible Duplicate: The Definitive C++ Book Guide and List i have a lot of

  • 0

Possible Duplicate:
The Definitive C++ Book Guide and List

i have a lot of questions about declaration and implementation, according to most (books, tutorials, blog entries) a class declaration with constructor, methods and member functions:

class Book
{
public:
    Book(const string & author_,
         const string & title_,
         const string & publisher_,
         double price_,
         double weight_);
    string getName()
    {
        string name;
        name = author + ": " + title;
        return name.substr(0, 40);
    }
    double getPrice();
    double getWeight();
private:
    string author, title, publisher;
    double price, weight;
};

i understand all the the access level, the Constructor, reference operator (pointer too!), the pointer operator, but when I read things less trivial like:

class Type
{
public:
    enum TypeT {stringT, intT, doubleT, unknownT};

    // 1. which means "explicit"?
    // 2. what's ": typeId(typeId_)"? after the Ctor declaration
    explicit Type(TypeT typeId_) : typeId(typeId_) {}

    // 3. "const" after the declaration which means?
    BaseValue * newValue() const
    {
        return prototypes[typeId]->clone();
    }

    TypeT getType() const
    {
        return typeId;
    }

    static void init();
    {
        prototypes[stringT] = new Value<string>("");
        prototypes[intT] = new Value<int>(0);
        prototypes[doubleT] = new Value<double>(0);
    }

private:
    TypeT typeId;

    static vector<BaseValue *> prototypes;
};

I feel lost and really have not found clear information about the above points.

Addition to answering my question, if you know somewhere where they have these “tricks” of language

  • 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-27T00:33:09+00:00Added an answer on May 27, 2026 at 12:33 am

    A good introductory book to C++ should answer your questions.

    1. explicit means the constructor must be mentioned explicitely in the code, the type cannot be constructed automatically from another type when required.
    2. Member initialization. The class member is not constructed with its default constructor, but rather the arguments given here.
    3. The method can be called on a const object.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: The Definitive C++ Book Guide and List I am faced with the
Possible Duplicate: The Definitive C Book Guide and List Good open source code for
Possible Duplicate: Is Java pass by reference? I have a question about passing by
Possible Duplicate: Git for beginners: The definitive practical guide With git, how do people
Possible Duplicate: What is the etymology of 'slug'? In CouchDB definitive guide the author
Possible Duplicate: Operator[][] overload I've looked on the internet but can't find a definitive
Possible Duplicate: JavaScript Function Definition in ASP User Control Hi, I have a generic
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want
Possible Duplicate: What do parentheses surrounding a JavaScript object/function/class declaration mean? What does this
Possible Duplicate: How do you generate dynamic (parameterized) unit tests in Python? I have

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.