http://www.perlmonks.org?node_id=883482


in reply to difference between OOPs in Perl and java

I don't like Perl OO too much, IMHO there are two many ways to do it! If you want to use OO in Perl I suggest to take a look at Moose. There is manual and a cookbook to get you started.

There are big differences, the two languages are completely different. On top of what ikegami said Let me add/clarify something on Inheritance. Perl supports both single and multiple inheritance. In Java multiple inheritance is not supported directly. This was a design decision. Instead Java has the concept of interfaces. According to some multiple inheritance is evil. The standard argument is the "diamond problem":

A / \ B C \ / D

Suppose a virtual method in A is implemented by both B and C. Question: Which one do you get when you instantiate D?

If you use the Java's interfaces it's not a problem, interfaces don't have implementations. If you make A, B, and C all interfaces, then D chooses how to implement the A method. The Java interfaces are a kind-of multiple inheritance but simplified. Having said this if you use abstract base clases with pure virtual functions (I'm thinking more C++ here) there is no reason why you can't use multiple inheritance.

Cheers

Harry