• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inheritance with array

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
do you mean this (which you can do):




or this (which you cannot):

 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Cougar Vis
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic