Instead of recovering the sf object back from parent class, why not just use the already existing sf handle? Or, why not just copy sf handle to sf2? What’s the real advantage of casting here?
As mentioned in the later part of the video, casting is useful when we have various subclasses that inherit from the same parent class. For example, when we dynamically allocate a subclass instance in parent class handle array, we store different subclass instance in the parent class handle and then use cast to detect later in the code which subclass instance is stored in the parent handle. This is just one of the examples.
Awesome series for repeating basic concepts. Good job
short, clear,accurate~!
good explantion. very good job
Instead of recovering the sf object back from parent class, why not just use the already existing sf handle? Or, why not just copy sf handle to sf2? What’s the real advantage of casting here?
As mentioned in the later part of the video, casting is useful when we have various subclasses that inherit from the same parent class. For example, when we dynamically allocate a subclass instance in parent class handle array, we store different subclass instance in the parent class handle and then use cast to detect later in the code which subclass instance is stored in the parent handle. This is just one of the examples.