Hello Simon,
If I add a getter-property that returns the field by value, the
following instruction "object.position.x = 12;" won't modify the
position of the object, but will only modify the returned copy of the
position, right?
That's actually why I'd like to have a getter that returns the fie
Simon TRENY wrote:
Daniel Keep Wrote:
Simon TRENY wrote:
Ok, but then, what if I'd like to make the variable "read-only"? i.e.
preventing the user from writing things like this:
myObject.position = pos2;
So... you're rejecting a solution on the basis that it prevents you from
doing the exa
Sat, 21 Mar 2009 09:55:13 -0400, Simon TRENY wrote:
>//This syntax is not working
>public ref Position position() {
> return m_position;
>}
D2 supports this.
D1 won't, ever. I think.
grauzone Wrote:
> Simon TRENY wrote:
> > grauzone Wrote:
> >
> >> Simon TRENY wrote:
> >>> Hi there!
> >>>
> >>> I'm quite new at D and I'm still just playing with it, but there is a
> >>> thing that I find currently missing. Sometimes, I'd like to be able to
> >>> return a struct by reference
Daniel Keep Wrote:
>
>
> Simon TRENY wrote:
> > Ok, but then, what if I'd like to make the variable "read-only"? i.e.
> > preventing the user from writing things like this:
> > myObject.position = pos2;
> >
>
> So... you're rejecting a solution on the basis that it prevents you from
> doing t
Simon TRENY wrote:
grauzone Wrote:
Simon TRENY wrote:
Hi there!
I'm quite new at D and I'm still just playing with it, but there is a thing
that I find currently missing. Sometimes, I'd like to be able to return a
struct by reference and not by value. For example, in the following example:
grauzone Wrote:
> Simon TRENY wrote:
> > Hi there!
> >
> > I'm quite new at D and I'm still just playing with it, but there is a thing
> > that I find currently missing. Sometimes, I'd like to be able to return a
> > struct by reference and not by value. For example, in the following example:
>
Simon TRENY wrote:
> Ok, but then, what if I'd like to make the variable "read-only"? i.e.
> preventing the user from writing things like this:
> myObject.position = pos2;
>
So... you're rejecting a solution on the basis that it prevents you from
doing the exact opposite of what you want to do
Simon TRENY wrote:
Hi there!
I'm quite new at D and I'm still just playing with it, but there is a thing
that I find currently missing. Sometimes, I'd like to be able to return a
struct by reference and not by value. For example, in the following example:
struct Position {
float x;
floa
Hi there!
I'm quite new at D and I'm still just playing with it, but there is a thing
that I find currently missing. Sometimes, I'd like to be able to return a
struct by reference and not by value. For example, in the following example:
struct Position {
float x;
float y;
}
class Object
10 matches
Mail list logo