我有两节课:
class ItemInfo {
public View createItemView() {
View v;
// ...
v.setTag(this);
return v;
}
}
class FolderInfo extends ItemInfo {
@Override
public View createItemView() {
View v;
// ...
v.setTag(this);
return v;
}
}
然后我使用它:
FolderInfo folderInfo;
// Create it here
ItemInfo itemInfo = folderInfo;
View v = itemInfo.createItemView();
Object objectTag = v.getTag();
然后我通过instanceof检查objectTag的类型,它是ItemInfo!为什么?