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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:01:40+00:00 2026-05-26T20:01:40+00:00

Taken from here: http://www.cplusplus.com/doc/tutorial/inheritance/ What is inherited from the base class? In principle, a

  • 0

Taken from here: http://www.cplusplus.com/doc/tutorial/inheritance/

What is inherited from the base class?
In principle, a derived class inherits every member of a base class except:

its constructor and its destructor
its operator=() members
its friends

My question is, what are operator=() members?

  • 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-26T20:01:41+00:00Added an answer on May 26, 2026 at 8:01 pm

    You can define any kind of operator=(). Even very useless ones. But non of them will be inherited to the child class. From your link site I changed the example a little to make it more clear. This example won’t compile because of the mentioned errors.

    class mother {
    public:
        mother ()
        { cout << "mother: no parameters\n"; }
        explicit mother (int a):m_int(a)
        { cout << "mother: int parameter\n"; }
    
        mother& operator=(mother const& rhs)
        {
            if(&rhs != this)
            {
                m_int = rhs.m_int;
            }
            return *this;
        }
    
        mother& operator=(int i)
        {
            m_int = i;
            return *this;
        }
    private:
        int m_int;
    };
    
    class son : public mother {
    public:
        explicit  son (int a) : mother (a)
        { cout << "son: int parameter\n\n"; }
    };
    int main()
    {
        mother mom(2);
        son daniel(0);
        mom = 3;
        daniel = 4; // compile error
        daniel = mom; // also error
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a code taken from http://www.angelfire.com/tx4/cus/shapes/haskell98.html . It compiles and executes correctly in
I'm working with a C# sample application (taken from here : http://www.piccoder.co.uk/content/view/42/26/1/4/ ) The
This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383 The Problem Assume the user gives
I've taken the accordion menu from http://www.i-marco.nl/weblog/ and have customised it to what I
I have a user input form here: http://www.7bks.com/create (Google login required) When you first
This is the code taken from http://code.google.com/p/crawler4j/ and the name of this file is
Please see the attached image: 1) I downloaded a new library here: ( http://www.java2s.com/Code/Jar/ABC/Downloadcommonslang24jar.htm
How should I understand $(select option:selected) in the following code ? (taken from here
I'm using django non-rel ( http://www.allbuttonspressed.com/projects/django-nonrel ) and am trying to delete all the
The following example is taken from: http://php.net/manual/en/function.curl-multi-close.php#example-3540 This example will create two cURL handles,

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.