Top.Mail.Ru
September 2nd, 2006 - Java developers — LiveJournal
? ?

Java developers

September 2nd, 2006

08:17 pm - androgy8 - emulating typedef functionality in Java

I've done some C++ coding, and in C++, I used "typedef" in order to create classes that had could contain easily changeable types. (For example, I could write: "TreeNodeType someData;" , and then with one typedef statement at the top of the file, could set TreeNodeType to an application-specific type, so that I re-use that class with different applications.)

Since Java does not have typedef, I am wondering how to emulate this functionality. I am hoping someone with experience can please clue me in on how to create similarly robust classes in Java. Perhaps I should create one master parent class with some arbitrary type, and then extend that class, changing the type as appropriate in children classes?
Powered by LiveJournal.com