OK I don't understand why I get a can't resolve symbol on my constructors. Here is the basics of my code 3 classes - 1st class 'A' is abstract has a default empty constructor and a constructor with A's attributes ex: public A( int getX ) { this.x = getX; }
2nd class B extends A and has default empty constructor (with a call to super()) and a constructor that calls A's constructor and adds B's attributes ex: public B( int getX, int getY) { super( getX ); this.y = getY; } OK so far so good, these files with their attributes and methods compile. Now I add class 'C'. I follow the same format as above creating 2 constructors, a default calling super(); and another that takes the B constructor and adds C's attributes. When I try to compile I get the following error:
I also get this error on the second constructor. I don't understand why this is happening. Any help would be appreciated. Thanks Dan
chi Lin
Ranch Hand
Joined: Aug 24, 2001
Posts: 348
posted
0
post your code so we can get the whole picture.
Ernest Friedman-Hill
author and iconoclast
Marshal
OK the classes A and B were defined by my teacher. They are actually classes Person and Employee. Someone else has posted in this forum from my class so I wanted to avoid posting code. The class I defined is SalesEmployee. Below is the Person class (the comments are from the teacher to the class):
Here is the teacher defined Employee class with her comments:
Lastly this is my code for SalesEmployee class:
Thanks all
Dan Taylor
Greenhorn
Joined: Apr 16, 2004
Posts: 10
posted
0
Any takers on this one? Please??
chi Lin
Ranch Hand
Joined: Aug 24, 2001
Posts: 348
posted
0
i try the code, it seems ok to me except the Company variable was rejected by compiler.
Gary Down
Ranch Hand
Joined: Apr 09, 2004
Posts: 46
posted
0
Likewise, I had no problems compiling your code.. had to create a dummy "Company" class. Suggest you ensure that the .class files are in sync with your .java files try compiling them again from the top down i.e. person first Good luck. Gary.