Delphi is like an England Queen Guard. It does not like ambiguity and may even kill to protect the hard code. But Java is almost a street corner woman. When I use this is java:
Button button = new Button();
String a = "This is a " + button;
I get This is a button
But if I do that in Delphi:
ShowMessage('This is a ' + Button1);
I get an error, because Delphi has toString()
method (now) but it does not implicitly calls it. Because literal strings are not objects in OP. The correct use is:
ShowMessage('This is a ' + Button1.toString());
Is there any way to override this behave so it works like Java?
For reference: How an object will call toString method implicitly?