Semua buku

Profesional

Aplikasi Tentang Pelatih Masuk Mulai membaca

Computer Science · Glosarium

Apa itu Rule of zero, rule of five?

Dikenal juga sebagai: rule of zero · rule of five

Definition 2.11 University Computer Science — Year 2 · Bab 2 — Copying, Moving and Smart Pointers

The rule of zero says that a class whose members all manage their own resources (strings, containers, smart pointers) should declare none of the five special members: the member-wise versions the compiler writes are correct. The rule of five says that a class that manages a resource itself, and so declares one of the five, should declare all five, each written or explicitly = default or = delete.

Baca dalam konteks →