Re: How to get value among subclasses



On Apr 11, 3:50 pm, Mark Space <marksp...@xxxxxxxxxxxxxx> wrote:
fzl2007 wrote:
I have four classes that are extended from the same superclass. Each
class need to be able to get the value (rssdid) that the other class
set. How do I do that?  I have tried to use the getter and setter. It

Unfortunately as Tom said things just don't work that way.

In Java, this is possible by using a static variable in the super class.
  However, while the theory maybe the same in ActionScript, I have no
idea how to do it.

package fubar;

public class SharedValues
{
     public static void main( String[] args )
     {
         Base1 b1 = new Base1();
         b1.setMessage( "The message" );
         Base2 b2 = new Base2();
         System.out.println( b2.getMessage() );
     }

}

class Super
{
     protected static String message;

     public void setMessage( String message )
     {
         this.message = message;
     }

     public String getMessage()
     {
         return message;
     }

}

class Base1 extends Super
{

}

class Base2 extends Super
{

}



Please forgive my ignorance about classes and objects. I have come
from a non object background and now have to continue a project that
was created and left by an OO person. I have tried to gather my
thoughts and summarized the problem and presented it here in hope to
get some help. I obviously have demonstrated more confusion than
anything. Perhaps let me try one more time ...

I am using four viewHelpers (they are classes that extends from the
same super class which is a subclass of another superclass and etc,
designed by this OO person) to retrieve data for four datagrids on a
tab object, each datagrid sits on a tab, a total of four datagrids/
tabs. Every time when a row on a datagrid (of a tab) is clicked, it
will need to pick up the customer ID and retrieve data for the same
customer on the other three datagrids/tabs. My problem is, I don't
know how to store the customer id when the row is clicked so that I
can retrieve the data for the other three tabs for the same customer
id.

Thank you for your time. I appreciate it.

Faye



.



Relevant Pages

  • Re: what is the RIGHT THING to make a constructor of a subclass, using super()
    ... If you are left with that requirement as a necessary or desirable part of the design, then the usual approach is probably to write a static method in the class that you call as an argument to the call to super() from your constructor. ... public Customer(String firstName, String lastName) { ... public class SlashSeparatedCustomer extends Customer { ...
    (comp.lang.java.programmer)
  • Re: what is the RIGHT THING to make a constructor of a subclass, using super()
    ... If you are left with that requirement as a necessary or desirable part of the design, then the usual approach is probably to write a static method in the class that you call as an argument to the call to super() from your constructor. ... public Customer(String firstName, String lastName) { ... public class SlashSeparatedCustomer extends Customer { ...
    (comp.lang.java.programmer)
  • Re: TextBox and PictureBox in Single Column of Windows For DataGrid + C#
    ... Maybe this FAQ will provide a solution to the tab skipping over your column. ... > I am dot designing new TextBox control, I just designing DataGrid Column ... >> public int FormLeft ... >> private void LeaveTextBox ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Linking subforms
    ... Select create a new database with Database wizard. ... Go to the database window and on the Forms tab click New. ... Use the form wizard to create a datasheet form based on the Customer ...
    (microsoft.public.access.forms)
  • Return vlookup result but only for the first hit
    ... complicating my problem here - hoping there's a simple answer - it's a ... a "customer" tab is used to identify the price ... Summers ...
    (microsoft.public.excel)