Разница между «наследовать от класса» и «наличие члена - это сам класс»C++

Программы на C++. Форум разработчиков
Гость
Разница между «наследовать от класса» и «наличие члена - это сам класс»

Сообщение Гость »


What is the differences between these two child classes generally, and specifically in relation to memory:
(1)

class parent{}; class child : parent{}; (2)

class parent{}; class child{ parent parent_object; }; Is that true that whatever functionality we can achieve with (1) we can achieve with (2) too?

Вернуться в «C++»