I have a type Time32 that is used in generics as Work so i made a class Time32.
I also have to implement
typedef UInt(5) Time32
Here UInt means the unsigned int. Java doesn't have unsigned int, so i made my own class.
public class UInt
{
private final int size;
public UInt(int x)
{
this.size=x;
}
public int getSize()
{
return size;
}
}
But i don't understand how i can implement the typedef in java. Please help. Thanks.
I need to keep the UInt class as i have some other variables that will use the Uint like UInt(20) Load or UInt(10) Force
解决方案
Since there are no typdefs in Java you cannot use them. The best approximation might be this:
public class Time32 extends UInt {
public Time32(){
super(5);
}
}