Interface question

xs0 xs0 at xs0.com
Thu Aug 31 03:18:00 PDT 2006


Paolo Invernizzi wrote:
> So, the answer is that a constructor signature cannot be part of an 
> interface?
> 
> We must use always the factory pattern?

Well, as far as I can tell, you can't create a new object without a new 
expression, in which you need to state the exact type, so even if you 
could specify a constructor signature in an interface, you still 
couldn't generically create an object.

If you could do it, though, what would the rest of the code look like? 
(I think you can't code around explicitly listing types somewhere, so 
I'm interested what you feel would be gained).


xs0



More information about the Digitalmars-d-learn mailing list