Quantcast
Channel: java traits or mixins pattern? - Stack Overflow
Viewing all articles
Browse latest Browse all 9

Answer by David Koelle for java traits or mixins pattern?

$
0
0

Java's answer to multiple inheritance is the ability to implement multiple interfaces. Of course, this means you'll get the method declarations, but not the logic.

You could try emulating mixins by composition: your Java class could define member variables that represent other classes that perform some common business logic.

In designing Java classes, I have not found the lack of C++ style multiple inheritance to inhibit the design of my architecture. You will find a way to achieve what you want to do.


Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images