diff --git a/sfml-const/fix2.cpp b/sfml-const/fix2.cpp index 34a4ddd..83984fc 100644 --- a/sfml-const/fix2.cpp +++ b/sfml-const/fix2.cpp @@ -1,5 +1,6 @@ #include #include "fix2.hpp" +#include using std::cout; @@ -8,19 +9,21 @@ void RenderTarget::draw(const Drawable& drawable) { } void Shape::draw(RenderTarget& target) const { - cout << "shape draw\n"; + assert(false && "You should not call this, use shape.draw(target) instead."); } void Shape::draw(RenderTarget &target) { - cout << "shape non-const instead\n"; + cout << "shape renders without const instead\n"; } int main() { RenderTarget target; Shape shape; - target.draw(shape); + // uncomment this to see the error when used wrong + // target.draw(shape); shape.draw(target); + return 0; }