aspose file tools*
The moose likes Beginning Java and the fly likes Inheritance with array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Inheritance with array" Watch "Inheritance with array" New topic
Author

Inheritance with array

Cougar Vis
Greenhorn

Joined: May 12, 2004
Posts: 19
can i use inheritance with array, where the array is stored in the Superclass (first level), then subclass for the methods?

Where can i find some examples for this?
john guthrie
Ranch Hand

Joined: Aug 05, 2002
Posts: 124
do you mean this (which you can do):




or this (which you cannot):

Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Can you describe the problem you are trying to solve with this approach? Also give some more detail about what you are trying to do. I'm not quite sure what you are asking about.

Also, have you tried to write code and compile it? In the end, the compiler is the ultimate arbiter that decides what you can and cannot do in the language.

Layne


Java API Documentation
The Java Tutorial
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
CougarV12,

Welcome to JavaRanch!

We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.

Thanks Pardner! Hope to see you 'round the Ranch!


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Cougar Vis
Greenhorn

Joined: May 12, 2004
Posts: 19
Originally posted by Marilyn de Queiroz:
CougarV12,

Welcome to JavaRanch!

We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.

Thanks Pardner! Hope to see you 'round the Ranch!


hmmm...what's wrong with my name, been using it since then ?
Cougar actually is my nick name, V12 = Vis


=======================================================================

I have no idea how to do and not sure whether you can use array in inheritance.

What i wanted to do is
Eg. 5 Radio cars each one of them can only have 2 action either "F" "B" "L" & "R".
I needed to use inheritance to save on the coding which it possiblely could, but not sure how to use array with it, so it store their action in the superclass, then execute the method in their subclasses
[ November 23, 2004: Message edited by: Cougar Vissert ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inheritance with array