Re: Changing the class data underneath some reference

2017-11-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/29/17 10:22 PM, Jonathan M Davis wrote: With classes, you could also assign the entire state of the object similar to what you'd get with structs and opAssign, but you'd have to write a member function to do it. There's no reason that you couldn't do the equivalent of opAssign. It's just

Re: Changing the class data underneath some reference

2017-11-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 29, 2017 21:12:58 Steven Schveighoffer via Digitalmars-d-learn wrote: > On 11/29/17 7:40 PM, David Colson wrote: > > Hello all! > > > > I'm getting settled into D and I came into a problem. A code sample > > shows it best: > > > > class SomeType > > { > > > > string

Re: Changing the class data underneath some reference

2017-11-29 Thread A Guy With a Question via Digitalmars-d-learn
On Thursday, 30 November 2017 at 00:40:51 UTC, David Colson wrote: Hello all! I'm getting settled into D and I came into a problem. A code sample shows it best: class SomeType { string text; this(string input) {text = input;} } void main() { SomeType foo = new

Re: Changing the class data underneath some reference

2017-11-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/29/17 7:40 PM, David Colson wrote: Hello all! I'm getting settled into D and I came into a problem. A code sample shows it best: class SomeType {     string text;     this(string input) {text = input;} } void main() {     SomeType foo = new SomeType("Hello");     SomeType bar =

Re: Changing the class data underneath some reference

2017-11-29 Thread codephantom via Digitalmars-d-learn
On Thursday, 30 November 2017 at 00:52:25 UTC, codephantom wrote: ... sorry, don't know how the int * got in there ;-) Anyway..who said you can't use pointers in D? Just change: //SomeType bar = foo; SomeType * bar =

Re: Changing the class data underneath some reference

2017-11-29 Thread codephantom via Digitalmars-d-learn
On Thursday, 30 November 2017 at 00:40:51 UTC, David Colson wrote: Hello all! I'm getting settled into D and I came into a problem. A code sample shows it best: class SomeType { string text; this(string input) {text = input;} } void main() { SomeType foo = new

Re: Changing the class data underneath some reference

2017-11-29 Thread David Colson via Digitalmars-d-learn
On Thursday, 30 November 2017 at 00:40:51 UTC, David Colson wrote: Hello all! I'm getting settled into D and I came into a problem. A code sample shows it best: class SomeType { string text; this(string input) {text = input;} } void main() { SomeType foo = new