• 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

Can't resolve symbol in inheritance

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
post your code so we can get the whole picture.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any takers on this one? Please??
 
chi Lin
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i try the code, it seems ok to me except the
Company variable was rejected by compiler.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic