memesearch
Iconic Trio Rule of Three

Iconic Trio Rule of Three

Download Find similar pictures
Text on the meme
Name a more iconic trio... I'll wait class rule_of_three { char *string; // raw pointer used as a handle to a dynamically-allocated memory block void init(const char* s) { std::size_t n = std::strlen(s) + 1; cstring = new char[n]; std::memcpy(cstring, s, n); // populate } public: rule_of_three(const char* s = "") { init(s); } ~rule_of_three() { delete[] cstring; // deallocate } rule_of_three(const rule_of_three& other) // copy constructor { init(other.cstring); } rule_of_three operator=(const rule_of_three& other) // copy assignment { if (this != &other) { delete[] cstring; // deallocate init(other.cstring); } return *this; } };
What it means

На изображении Ким Кардашьян, Кайли Дженнер и Хлои Кардашьян стоят вместе под подписью «Name a more iconic trio... I'll wait». Ниже показан код C++ с правилом трёх: шутка сравнивает знаменитое трио сестёр с тремя специальными функциями управления памятью — конструктором копирования, оператором присваивания и деструктором. EN: Kim Kardashian, Kylie Jenner, and Khloé Kardashian stand together beneath the caption “Name a more iconic trio... I'll wait.” Below them is C++ code demonstrating the rule of three: the joke compares the iconic trio of sisters with the three special memory-management functions—a copy constructor, copy-assignment operator, and destructor.

Who
Objects
Tags
Source
Type
image
Size
471×800 · 84.0 KiB
Mood
ироничный, умный
Language
en
Added