http://d.puremagic.com/issues/show_bug.cgi?id=6046
Summary: Not true for Java about Function Hijacking. Product: D Version: unspecified Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: websites AssignedTo: nob...@puremagic.com ReportedBy: on...@yahoo.com --- Comment #0 from Matthew Ong <on...@yahoo.com> 2011-05-23 02:45:48 PDT --- Hi Digitalmars/Walter Bright, http://www.digitalmars.com/d/2.0/hijack.html This talk covers function hijacking, where adding innocent and reasonable declarations in a module can wreak arbitrary havoc on an application program in C++(maybe true) and Java(not true). Since I have not done C++ for a long while, I am not going to comment about that. But Java I have to place this request for correction from DigitalMars. javac(from sun) Compiler will complain if there is an ambiguous to link any indentifier that has the same signature for contructor, methods(static/overloaded/overriden) Overload Sets Java denys global functions. All functions/methods are within a single class. Within the same class, the overloaded methods cannot have the same signature. public class MyClass{ public int myVal(){ } public String myVal(){ // compiler will complain here as error and NOT warning. } } Both the method identifier and zero param list makes a identical signature. Derived Class Member Function Hijacking IDE like Netbeans and does flag: @override public void myMethodA(){ // Say you did not use the override tag } Base Class Member Function Hijacking to prevent the child class from stealing your implementation for this single method, do: public final void myMethodA(){ // final == sealed in C# } That is shown clearly when you tries to import both this 2 classes within Java: import java.util.Date; import java.sql.Date; public class MyTest{ public static void main(String[] args){ Date now=new Date(); // thinking that you are using java.util.Date; } } Again, as a senior Java Developer since java jdk 1.1 I agrees D as a good replacement for C++ because of modern design and approaches. Kindly correct that to avoid confusing the new Java to D developer. There are also other run time intelligent build into JVM to avoid malicious hacker attack on such thing using class proxy & stub. -- Matthew Ong email: on...@yahoo.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------