What is virtual constructors/destructors?
Answers
Answered by
1
- Virtual destructors: If an object (with a non-virtual destructor) is destroyed explicitly by applying the delete operator to a base-class pointer to the object, the base-class destructor function (matching the pointer type) is called on the object.
Answered by
2
- ᴠɪʀᴛᴜᴀʟ ᴅᴇsᴛʀᴜᴄᴛᴏʀs: ɪғ ᴀɴ ᴏʙᴊᴇᴄᴛ (ᴡɪᴛʜ ᴀ ɴᴏɴ-ᴠɪʀᴛᴜᴀʟ ᴅᴇsᴛʀᴜᴄᴛᴏʀ) ɪs ᴅᴇsᴛʀᴏʏᴇᴅ ᴇxᴘʟɪᴄɪᴛʟʏ ʙʏ ᴀᴘᴘʟʏɪɴɢ ᴛʜᴇ ᴅᴇʟᴇᴛᴇ ᴏᴘᴇʀᴀᴛᴏʀ ᴛᴏ ᴀ ʙᴀsᴇ-ᴄʟᴀss ᴘᴏɪɴᴛᴇʀ ᴛᴏ ᴛʜᴇ ᴏʙᴊᴇᴄᴛ, ᴛʜᴇ ʙᴀsᴇ-ᴄʟᴀss ᴅᴇsᴛʀᴜᴄᴛᴏʀ ғᴜɴᴄᴛɪᴏɴ (ᴍᴀᴛᴄʜɪɴɢ ᴛʜᴇ ᴘᴏɪɴᴛᴇʀ ᴛʏᴘᴇ) ɪs ᴄᴀʟʟᴇᴅ ᴏɴ ᴛʜᴇ ᴏʙᴊᴇᴄᴛ.
Similar questions
Science,
5 months ago
Math,
5 months ago
Social Sciences,
10 months ago
Social Sciences,
10 months ago
Physics,
11 months ago
English,
11 months ago