Re: basic question on C++
From: Leor Zolman (leor_at_bdsoft.com)
Date: 02/05/04
- Next message: KPR: "Re: Input string vs. char array"
- Previous message: KPR: "Input string vs. char array"
- In reply to: Digital Puer: "basic question on C++"
- Next in thread: Chris \( Val \): "Re: basic question on C++"
- Reply: Chris \( Val \): "Re: basic question on C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 05 Feb 2004 02:28:08 GMT
On Wed, 04 Feb 2004 17:21:50 -0800, Digital Puer
<digital_puer@hotjail.comet> wrote:
>On a job interview question, this was asked:
>
> From the point of view of a derived class, how do you set
>variables in the base class to be all private? Give
>an example using class A (base) and B (derived).
>
>Any ideas? I can't clarify because that's all that was given.
>
All I can think of is that "how do you set variables in the base class
to be all private" is meant as if it were followed with "...to the
derived class" (since the sentence begins, "From the point of view of
a derived class"). So another way of asking this would be, "How can a
derived class make sure that all the accessible variables it inherits
from its base class are not accessible to its further derived
classes". That would be via private inheritance:
class B : private A {
...
};
-leor
Leor Zolman
BD Software
leor@bdsoft.com
www.bdsoft.com -- On-Site Training in C/C++, Java, Perl & Unix
C++ users: Download BD Software's free STL Error Message
Decryptor at www.bdsoft.com/tools/stlfilt.html
- Next message: KPR: "Re: Input string vs. char array"
- Previous message: KPR: "Input string vs. char array"
- In reply to: Digital Puer: "basic question on C++"
- Next in thread: Chris \( Val \): "Re: basic question on C++"
- Reply: Chris \( Val \): "Re: basic question on C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|