I have an example class with two class functions Foo
. One takes an argument, the other doesn't:
TContoso = class
class function Foo: IUnknown; overload;
class function Foo(bar: IUnknown): IUnknown; overload;
end;
And i can call my static function without incident:
unk := TContoso.Foo;
But if the methods were named what i wanted to call them in the first place:
TContoso = class
class function Create: IUnknown; overload;
class function Create(bar: IUnknown): IUnknown; overload;
end;
Then the same class method call:
unk := TContoso.Create;
fails to compile:
Ambiguous overload call to 'Create'
Why is the non-ambiguous call ambigious? I hope it's not an arbitrary thing.
Why would you do that?
Not that it matters to the question, but if we ignore the question and focus on the situation i'm in, some would recognize the pattern:
CoXmlWriter = class
class function Create: IXmlWriter; overload;
class function Create(const stream: ISequentialStream): IXmlWriter; overload;
end;