Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #6946

Re: Getters and Setters

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed101.telia.com!starscream.dk.telia.net!news.tele.dk!feed118.news.tele.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date Tue, 09 Aug 2011 22:37:09 -0400
From Arne Vajhøj <arne@vajhoej.dk>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: Getters and Setters
References <79c811c0-8eec-4c87-8027-2bc971818278@l9g2000prd.googlegroups.com>
In-Reply-To <79c811c0-8eec-4c87-8027-2bc971818278@l9g2000prd.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Lines 11
Message-ID <4e41eed9$0$306$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source
NNTP-Posting-Host 72.192.23.157
X-Trace news.sunsite.dk DXC=f74GTSkdEIAc5QH[6O^X]LYSB=nbEKnkKSFf==e;ieSCJPe3\kP5EUAKBm9cfh9BSDM2;kT<[:>[AB8=H]I6T1]CYeC_AHAL2CG
X-Complaints-To staff@sunsite.dk
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6946

Show key headers only | View raw


On 8/9/2011 9:59 PM, Vikram wrote:
> Why do we use getter and setters if we can do the same work by
> declaring the public data members.

I would say that argument #1 is that additional functionality
to the getters and setters can be added later without changes to
the calling code and argument #2 is that getters and setters are
polymorphic which fields are not.

Arne

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Getters and Setters Vikram <vpradhan33@gmail.com> - 2011-08-09 18:59 -0700
  Re: Getters and Setters "John B. Matthews" <nospam@nospam.invalid> - 2011-08-09 22:11 -0400
  Re: Getters and Setters Arne Vajhøj <arne@vajhoej.dk> - 2011-08-09 22:37 -0400
  Re: Getters and Setters Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-09 23:30 -0400
    Re: Getters and Setters Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-10 06:34 -0300
  Re: Getters and Setters Roedy Green <see_website@mindprod.com.invalid> - 2011-08-09 21:50 -0700

csiph-web