Jack Englund
08/25/2019, 3:26 AMclass Car: Vehicle()
...
getObjectChildClass(Car())
...
fun getObjectChildClass(obj: Vehicle) {
// From here I want the to know if it's a Car or some other class that extends vehicle, like Truck.
}
Jack Englund
08/25/2019, 3:39 AMLuca Nicoletti
08/25/2019, 5:51 AMobj::class.java.name
Jack Englund
08/25/2019, 6:25 AMLuca Nicoletti
08/25/2019, 6:28 AMJack Englund
08/25/2019, 6:54 AMThomas
08/25/2019, 8:25 AMJack Englund
08/26/2019, 12:09 AMHashMap<DataType, Packet>
. I'm using the DataType enum beacuse I have X amount of classes that might be stored as a Packet. Originally I had a helper method, classToDataType()
, which I wanted to give a class, and then have it return the data type.
I could've done type check but then I would have to make a list of possible classes and check every one. Given that it's part of caching I dont want to have to loop a potentially large list every time.Thomas
08/26/2019, 6:55 AM