www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4731] New: cannot call protected base class method by using base class name

http://d.puremagic.com/issues/show_bug.cgi?id=4731

           Summary: cannot call protected base class method by using base
                    class name
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: spam extrawurst.org


--- Comment #0 from Stephan Dilly <spam extrawurst.org> 2010-08-26 09:41:13 PDT
---
the way how one has to invoke protected base class methods in D seems to be
inconsistent. why do i have to use the super keyword ? using the base class
name works in case of being public, why is protected any different ?


module Foo;

class Base
{
protected void foo() {}
}

module main;

import Foo;

class Super : Base
{
override protected void foo() {super.foo();} // works
//override void foo() {Base.foo();} // does not work:
//Error: class Foo.Base member foo is not accessible
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 26 2010