www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2853] New: Property overriding problem

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2853

           Summary: Property overriding problem
           Product: D
           Version: 1.043
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: d294934 bsnow.net


class Base
{
        int number() { return _number; } // getter
        int number(int value) { return _number; } // setter

private:
        int _number;
}

class Extension: Base
{       
        override int number(int value)  // override setter
        {
                return 0; 
        }

        void method()
        {
                printNumber(this.number); // call base getter

                // main.d(21): Error: function main.Extension.number (int) does
not match parameter types ()
                // main.d(21): Error: expected 1 arguments, not 0
        }
}

Tries call overrided setter


-- 
Apr 18 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2853





------- Comment #1 from 2korden gmail.com  2009-04-18 19:23 -------
Fake properties must die, all I can say.


-- 
Apr 18 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2853


Witold Baryluk <baryluk smp.if.uj.edu.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |baryluk smp.if.uj.edu.pl


--- Comment #2 from Witold Baryluk <baryluk smp.if.uj.edu.pl> 2010-02-05
06:01:31 PST ---
Actually setter in the base class is not needed to trigger this bug.

Also calling this.number() in method(), so adding call brackets, doesn't solve
problem. So it is not only problem with setter/getter. This can lead to problem
with perfectly valid code with no properties.

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