Computer Science, asked by raman7325, 10 months ago

What is virtual constructors/destructors?

Answers

Answered by ItzBacteria
1

{\huge{\pink{↬}}} \: \: {\huge{\underline{\boxed{\bf{\pink{Answer}}}}}}

  • 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 Decentillusion
2

{\huge{\pink{↬}}} \: \: {\huge{\underline{\boxed{\bf{\pink{Answer}}}}}}

  • ᴠɪʀᴛᴜᴀʟ ᴅᴇsᴛʀᴜᴄᴛᴏʀs: ɪғ ᴀɴ ᴏʙᴊᴇᴄᴛ (ᴡɪᴛʜ ᴀ ɴᴏɴ-ᴠɪʀᴛᴜᴀʟ ᴅᴇsᴛʀᴜᴄᴛᴏʀ) ɪs ᴅᴇsᴛʀᴏʏᴇᴅ ᴇxᴘʟɪᴄɪᴛʟʏ ʙʏ ᴀᴘᴘʟʏɪɴɢ ᴛʜᴇ ᴅᴇʟᴇᴛᴇ ᴏᴘᴇʀᴀᴛᴏʀ ᴛᴏ ᴀ ʙᴀsᴇ-ᴄʟᴀss ᴘᴏɪɴᴛᴇʀ ᴛᴏ ᴛʜᴇ ᴏʙᴊᴇᴄᴛ, ᴛʜᴇ ʙᴀsᴇ-ᴄʟᴀss ᴅᴇsᴛʀᴜᴄᴛᴏʀ ғᴜɴᴄᴛɪᴏɴ (ᴍᴀᴛᴄʜɪɴɢ ᴛʜᴇ ᴘᴏɪɴᴛᴇʀ ᴛʏᴘᴇ) ɪs ᴄᴀʟʟᴇᴅ ᴏɴ ᴛʜᴇ ᴏʙᴊᴇᴄᴛ.
Similar questions