english icon indicating copy to clipboard operation
english copied to clipboard

explain difference between classes and structs - basics/classes

Open wilzbach opened this issue 9 years ago • 1 comments

From @wilzbach on June 24, 2016 16:47

why and when we should pick classes over struct

(reported by @claudiug)

Copied from original issue: stonemaster/dlang-tour#360

wilzbach avatar Aug 21 '16 14:08 wilzbach

use of struct is "D-ish", because they don't require GC allocation.

Classes are great if you have one instance a couple of time and/or over the lifetime of your application.

wilzbach avatar Aug 21 '16 14:08 wilzbach