| Author |
object inheritance...?
|
Chris Dancy
Ranch Hand
Joined: Feb 14, 2006
Posts: 136
|
|
so I have an array of public static Objects[] obj = (new Curriculum(),new referrences(),new Transcripts(),new Resume()); each of these 4 classes holds 3 arrays: public static Objects [][] obj; public static String [] con; public static String []; //The problem comes when i pass the reference of these objects i.e.: for(int i = 0;i < obj.length;i++){ initializeObject(obj[i]); } //This is where the problem happens public void initializeObject(Object i){ i.con[i] = new String("bearss"); } //This code is always highlighted as something is wrong. It sais that i.con[i] is not a valid field or something to that degree. I have a feeling that when I pass each reference in as an object something bad is happening. Though I cant figure out why, seeing as every object is an object!!! any ideas? sincerely, Chris Dancy
|
("Anger is not an emotion, its a symptom of fear.")
|
 |
Jhakda Velu
Ranch Hand
Joined: Feb 26, 2008
Posts: 158
|
|
Hi the first i stands for the object the second i should be the index, but where have you declared it? if you say in teh for loop, that i will not be available in the initializeObject method. What do you feel? Jhakda
|
If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9946
|
|
It sais that i.con[i] is not a valid field or something to that degree
believe it or not, what is says is VERY helpful. It would help us help you if you posted EXACTLY what it says...
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Jhakda Velu
Ranch Hand
Joined: Feb 26, 2008
Posts: 158
|
|
Hi Okie,i may be wrong. Please post complete error. Jhakda
|
 |
Chris Dancy
Ranch Hand
Joined: Feb 14, 2006
Posts: 136
|
|
Its ok guys i figured it out. I simply created an abstract class and had all my four classes extend from that. That worked out beautifully. Im still puzzled as to why I had to do that considering i was just referencing an object being passed in, but its ok. Thanks anyway. and sorry for not completing the code snippet I was in a bit of a rush and posted it at the last minute. sincerely, Chris Dancy
|
 |
 |
|
|
subject: object inheritance...?
|
|
|