Problem with synchronized and overloaded methods

Jacob Carlborg doob at me.com
Sun Sep 12 11:39:44 PDT 2010


The following peace of code doesn't not compile using D2:

class Base
{
     synchronized void func (string s) { }
     synchronized void func (Object o) { }
}

class Foo : Base
{
     synchronized override void func (string key) { super.func(key); }
}

The compiler gives this error:

main.d(13): Error: function main.Base.func (string s) shared is not 
callable using argument types (string)
main.d(13): Error: cannot implicitly convert expression (key) of type 
string to object.Object

If I remove "synchronized" from the method declarations I don't get this 
error. What have I missed?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list