Solved

mutable base class

Posted on 2001-09-08
1
270 Views
Last Modified: 2012-06-27
In the case of multiple inheritance

class A{
...
};

class B{
...
};

class C:
 public A,
 public B{

 int func()const;
};


I wish func to be able to change data members derived via class A but not those derived via class B.

I would like to say

class C:
 mutable public A,
 public B{

but this is illegal.

What is the best solution which achieves what I want?
0
Comment
Question by:glebspy
1 Comment
 
LVL 6

Accepted Solution

by:
thienpnguyen earned 50 total points
ID: 6467466
class C : pulbic B
{
    mutable A a;
   int func()const;
};

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question