Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't resolve symbol in inheritance

 
Dan Taylor
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
post your code so we can get the whole picture.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your definition of the no-argument constructor. Did you accidentally give it a return value, making it into an ordinary method?
 
Dan Taylor
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any takers on this one? Please??
 
chi Lin
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i try the code, it seems ok to me except the
Company variable was rejected by compiler.
 
Gary Down
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic