Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Both {{c1::new}} and {{c1::override}} keywords are used by {{c2::derived}} classes to {{c2::override}} methods from their {{c2::base classes}}. However, {{c1::new}} doesn't need the method in the base class to be marked {{c3::abstract}}, {{c3::override}}, or {{c3::virtual}}.
- However one specific difference happens when you declare a {{c4::base class}} variable and assign a d{{c4::erived}} c{{c4::lass}} to it. If it's just overriden using {{c1::override}}, it will call the {{c5::derived}} method whereas if you use {{c1::new}}, it will call the {{c5::base}} method.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement