digitalmars.D.learn - What does scope do as storage class?
- Marc (5/5) Dec 23 2017 for example:
- Jonathan M Davis (4/9) Dec 23 2017 Absolutely nothing.
- Nemanja Boric (14/26) Dec 23 2017 There's one special case, though, with scope in classes - scope
for example: scope struct S { int x; } What does scope do here?
Dec 23 2017
On Saturday, December 23, 2017 21:05:25 Marc via Digitalmars-d-learn wrote:for example: scope struct S { int x; } What does scope do here?Absolutely nothing. https://stackoverflow.com/questions/47240714/d-pure-classes-and-structs - Jonathan M Davis
Dec 23 2017
On Saturday, 23 December 2017 at 21:20:13 UTC, Jonathan M Davis wrote:On Saturday, December 23, 2017 21:05:25 Marc via Digitalmars-d-learn wrote:There's one special case, though, with scope in classes - scope will force user to allocate class as a scope: ``` scope class X { int x; } void main() { auto instance = new X; // ERROR must be scope instance = new X; } ```for example: scope struct S { int x; } What does scope do here?Absolutely nothing. https://stackoverflow.com/questions/47240714/d-pure-classes-and-structs - Jonathan M Davis
Dec 23 2017