Skip to content
Commit 4bf181e9 authored by Akarsh Simha's avatar Akarsh Simha
Browse files

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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment