Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //DeviceAndriod.java
  2. class DeviceAndriod {
  3.   print(x){
  4.      nativePrintCommand(x);
  5.   }
  6. }
  7.  
  8. //DeviceIOS.cpp
  9. class DeviceIOS{
  10.   print(x){
  11.      nativePrintCommand(x);
  12.   }
  13. }
  14.  
  15. //IDevice.hx
  16. interface IDevice{
  17.     print();
  18. }
  19.  
  20. //DeviceAndriod .hx
  21. import DeviceAndriod.java as DeviceAndriodJava;
  22. class DeviceAndriod implements IDevice{
  23.     print(x){
  24.       DeviceAndriodJava.print(x);
  25.     }
  26. }
  27.  
  28. //DeviceIOS.hx
  29. import DeviceIOS.cpp DeviceIOSCpp;
  30. class DeviceIOS implements IDevice{
  31.     print(x){
  32.       DeviceIOSCpp.print(x);
  33.     }
  34. }
  35.  
  36. @if java
  37. import device from DeviceAndriod
  38. @else
  39. import device from DeviceIOS
  40.  
  41. class Main {
  42.     run(){
  43.      device.print(123);
  44.     }
  45. }
  46.  
  47. // Compile to Haxe to Java or Cpp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement