Re: Weird behavior of this in a subclass, I think?

2015-07-16 Thread Daniel Kozák via Digitalmars-d-learn
On Thu, 16 Jul 2015 00:18:30 + seashell86 via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: So I've been mostly just toying around with D as it seems like it will end up being a strong language for game development both now and even moreso in the future. That being said,

Re: Weird behavior of this in a subclass, I think?

2015-07-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-16 09:46, Jonathan M Davis via Digitalmars-d-learn wrote: I've never heard of a language that overloaded member variables, and given how class polymorphism works, I don't see how it would even be possible without making it so that all accesses to a variable actually call a function

Re: Weird behavior of this in a subclass, I think?

2015-07-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 16, 2015 01:20:10 seashell86 via Digitalmars-d-learn wrote: On Thursday, 16 July 2015 at 00:39:29 UTC, H. S. Teoh wrote: On Thu, Jul 16, 2015 at 12:18:30AM +, seashell86 via Digitalmars-d-learn wrote: [...] The reason is that class variables cannot be overridden,

Re: Weird behavior of this in a subclass, I think?

2015-07-15 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 16 July 2015 at 00:39:29 UTC, H. S. Teoh wrote: If you want to simulate overriding of class variables, you can use a @property method instead: class Animal { @property string voice() { return Wah!; } void speak() { writeln(voice); }

Re: Weird behavior of this in a subclass, I think?

2015-07-15 Thread seashell86 via Digitalmars-d-learn
On Thursday, 16 July 2015 at 00:39:29 UTC, H. S. Teoh wrote: On Thu, Jul 16, 2015 at 12:18:30AM +, seashell86 via Digitalmars-d-learn wrote: [...] The reason is that class variables cannot be overridden, only class methods can. If you want to simulate overriding of class variables, you

Weird behavior of this in a subclass, I think?

2015-07-15 Thread seashell86 via Digitalmars-d-learn
So I've been mostly just toying around with D as it seems like it will end up being a strong language for game development both now and even moreso in the future. That being said, I'm perplexed by using this code and not receiving the result I would imagine. Here is the source code of a basic

Re: Weird behavior of this in a subclass, I think?

2015-07-15 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jul 16, 2015 at 12:18:30AM +, seashell86 via Digitalmars-d-learn wrote: So I've been mostly just toying around with D as it seems like it will end up being a strong language for game development both now and even moreso in the future. That being said, I'm perplexed by using this