Add safeguard against subclassing SkyObject without implementing clone()
Since SkyObject is not a virtual class, it is impossible to enforce its children to implement the clone() method. The clone() method creates a copy of the correct type and avoids the slicing problem. This is a way of alerting developers by a failed assert if we forget to implement the clone() method in a SkyObject subclass. (Since I learned that this had a name and a well known solution only today, here's a link on object slicing to help others who do not know: https://en.wikipedia.org/wiki/Object_slicing )
parent
364bc707
Please register or sign in to comment