We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. C++
  3. Inheritance
  4. Magic Spells
  5. Discussions

Magic Spells

Problem
Submissions
Leaderboard
Discussions

    You are viewing a single comment's thread. Return to all comments →

  • sommerlad_peter 4 years ago+ 0 comments

    Note: This is a very bad code example!

    The code is producing memory leaks!!! none of the cast spells is ever deallocated in main. Do not do that! if you need a polymorphic return use std::shared_ptr and make_shared or unique_ptr and make_unique.

    36|
    Permalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature