1. Home
  2. Computer Science MCQs
  3. C++ and Object-Oriented Programming
  4. What happens when a derived object is copied into a base…

Added 30 Nov -0001

What happens when a derived object is copied into a base class object?

  1. The derived part is sliced away Correct answer
  2. The base part is discarded
  3. The copy keeps both dynamic parts
  4. The compiler rejects the copy

Correct answer

A. The derived part is sliced away

15 views

MCQSEXAM

Explanation

Only the base subobject is copied, an effect known as object slicing.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C++ and Object-Oriented Programming MCQs

Practise all C++ and Object-Oriented Programming MCQs

Similar MCQs