I am trying to create a shopping cart object that should be able to register different product class like the `registerClass:forCellWithReuseIdentifier:` in `UICollectionView` and cast the object dynamically.

For example:

```
@property (nonatomic) Class productClass;

_productClass *product = (_productClass*)array[0];

```

Is this allowed in objective-c? If yes, please provide some sample code, thanks!