www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - base class protection

reply qniol <qniol o2.pl> writes:
Hello!

What's "protection" here for?

class Duper : protection Super { ... }

for protection being either:
private
package
public
export

and Super being a class.

C++'s intuition let me down. D 1.0/2.0 ref. too (I got accustomed to it).

thx for help!
Jun 20 2009
next sibling parent reply Daniel Keep <daniel.keep.lists gmail.com> writes:
qniol wrote:
 Hello!
 
 What's "protection" here for?
 
 class Duper : protection Super { ... }
 
 for protection being either:
 private
 package
 public
 export
 
 and Super being a class.

As far as I know, it doesn't *do* anything.
 C++'s intuition let me down. D 1.0/2.0 ref. too (I got accustomed to it).
 
 thx for help!

You'll have to be more specific about ref for us to be of assistance.
Jun 20 2009
parent Frank Benoit <keinfarbton googlemail.com> writes:
Daniel Keep schrieb:
 
 qniol wrote:
 Hello!

 What's "protection" here for?

 class Duper : protection Super { ... }

 for protection being either:
 private
 package
 public
 export

 and Super being a class.

As far as I know, it doesn't *do* anything.

As far as I know, it *does* break compatibility with "Object". http://d.puremagic.com/issues/show_bug.cgi?id=177
Jun 20 2009
prev sibling parent Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
On Sat, Jun 20, 2009 at 4:51 AM, qniol<qniol o2.pl> wrote:
 Hello!

 What's "protection" here for?

 class Duper : protection Super { ... }

 for protection being either:
 private
 package
 public
 export

 and Super being a class.

It's a remnant from presumably an earlier period in D's development. Without MI, it's pointless. The default is public, and using anything other than public just breaks things. I'm surprised (well,.. not really) that it's been in the spec and compiler for so long without having been removed.
Jun 20 2009