I am facing a problem with a helper class I'm working on to translate between two classes with the same name. Both classes are beyond my control, so I canβt just rename them.
My main options include a full namespace declaration for at least one of the types:
import com.myco.second.long.package.namespace.MyObject; public class MyObjectConvertor { MyObject transform(com.myco.first.long.package.namespace.MyObject o) {} }
Or the reverse approach:
import com.myco.first.long.package.namespace.MyObject; public class MyObjectConvertor { com.myco.second.long.package.namespace.MyObject transform(MyObject o) {} }
Or by declaring both namespaces, for a more explicit pattern:
public class MyObjectConvertor { com.myco.second.long.package.namespace.MyObject transform(com.myco.first.long.package.namespace.MyObject o) {} }
Is there any other solution that could tidy up these method signatures? I am wondering if some kind of "typedef" style solution is possible in C ++?
source share