groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Sun <realblue...@hotmail.com>
Subject Re: About declaring the field and property with same name
Date Thu, 13 Jul 2017 03:44:43 GMT
Hi Jochen,

      OK, I see... but the feature is really wired, I don't know why we need
it.

Cheers,
Daniel.Sun
--------------------------------------------
class Person {
    String name = '123'
    private name = 123
}

new Person().getName().class // class java.lang.Integer

--------------------------------------------
class Person {
    String name = '123'
    private name = 123
    
    public String getName() {
        return this.name;
    }
}

new Person().getName().class  // class java.lang.String



--
View this message in context: http://groovy.329449.n5.nabble.com/About-declaring-the-field-and-property-with-same-name-tp5742010p5742078.html
Sent from the Groovy Dev mailing list archive at Nabble.com.

Mime
View raw message