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


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

Re: Need help with a program.

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From yanamandra <venu.yanamandra@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Need help with a program.
Date Mon, 20 Aug 2012 02:57:19 -0700 (PDT)
Organization http://groups.google.com
Lines 23
Message-ID <8fc96fef-1eb1-41bb-a5d2-619ce71f5101@googlegroups.com> (permalink)
References <82bcd41c-df92-4103-b674-718cf64a999b@x8g2000yqf.googlegroups.com> <Rp-dnfT58e_Vm6_NnZ2dnUVZ8kydnZ2d@giganews.com>
NNTP-Posting-Host 143.166.255.60
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1345456724 10758 127.0.0.1 (20 Aug 2012 09:58:44 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Mon, 20 Aug 2012 09:58:44 +0000 (UTC)
In-Reply-To <Rp-dnfT58e_Vm6_NnZ2dnUVZ8kydnZ2d@giganews.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=143.166.255.60; posting-account=HXif8QoAAABvkFWZ3-nUQ98DlhgNd9tU
User-Agent G2/1.0
Xref csiph.com comp.lang.java.programmer:18170

Show key headers only | View raw


On Monday, August 20, 2012 3:11:28 PM UTC+5:30, Leif Roar Moldskred wrote:
> yanamandra wrote: > Why does the function printall() print the base class (c1) member > values? If that is reasonable, what is the method to print the > extended class (cls) values using the base class function printall(). I take it school's back in session? The issue you're running into is called variable shadowing. Reading up on that should give you the answer to your problem. -- Leif Roar Moldskred

But, variable shadowing is about the instance and local || local and scope specific. I have read the articles again after you asked me too. No luck on the exact problem I am mentioning. 

I am talking about inherited variables. there is i1, i2 and i3 in the super class with a method printall. there are the same 3 variables in the derived class but there is no printall method in the sub class. When printall() is invoked from the derived class's object, it still prints the super-class's values.

And, if this is reasonable, what is the method by which I can get: 40, 50 and 60 as the output from printall() when I invoke it using a derived class's object?

-Venu

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


Thread

Need help with a program. yanamandra <venu.yanamandra@gmail.com> - 2012-08-20 02:24 -0700
  Re: Need help with a program. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-08-20 04:41 -0500
    Re: Need help with a program. yanamandra <venu.yanamandra@gmail.com> - 2012-08-20 02:57 -0700
      Re: Need help with a program. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-08-20 05:16 -0500
        Re: Need help with a program. yanamandra <venu.yanamandra@gmail.com> - 2012-08-20 03:39 -0700
          Re: Need help with a program. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-08-20 06:46 -0500
            Re: Need help with a program. yanamandra <venu.yanamandra@gmail.com> - 2012-08-20 04:58 -0700
          Re: Need help with a program. Lew <noone@lewscanon.com> - 2012-08-20 07:31 -0700
            Re: Need help with a program. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-08-21 03:43 -0500
  Re: Need help with a program. Roedy Green <see_website@mindprod.com.invalid> - 2012-08-20 17:22 -0700

csiph-web