Results 1 to 3 of 3
Thread: Inheritance
- 05-20-2012, 06:36 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 7
- Rep Power
- 0
Inheritance
I am working on an assignment and cannot figure out why i am getting errors when trying to inheret from a superclass. I have the following structure
Person - which is the super class
ClassPerson - which inherits from the Person class
Instructor - which inherits from the ClassPerson class
I can compile the Person and ClassPerson classes, however when i attempt to compile the instructor class i get the following error:
"Cannot find symbol - constructor ClassPerson (java.lang.String, java.lang.String)"
My code is as follows:
public class Person
{
private String firstName;
private String lastName;
private double heightInCentimeters;
private int weightInKg;
/**
* Constructor for objects of class Person
*/
public Person(String firstName, String lastName, double heightInCentimeters, int weightInKg)
{
this.firstName = firstName;
this.lastName = lastName;
this.heightInCentimeters = heightInCentimeters;
this.weightInKg = weightInKg;
}
------------------------------------------------------------------------------------------------------------------------------------------------
public class ClassPerson extends Person
{
private String studentNumber;
private String emailAddress;
/**
* Constructor for objects of class ClassPerson
*/
public ClassPerson(String firstName, String lastName, double heightInCentimeters, int weightInKg,
String studentNumber, String emailAddress)
{
super (firstName,lastName,heightInCentimeters,weightInKg );
this.studentNumber = studentNumber;
this.emailAddress = emailAddress;
}
--------------------------------------------------------------------------------------------------------------------------------------
public class Instructor extends ClassPerson
{
private int hourlyWage;
/**
* Constructor for objects of class Instructor
*/
public Instructor(String studentNumber, String emailAddress, int hourlyWage)
{
super(studentNumber,emailAddress);
this.hourlyWage = hourlyWage;
}
----------------------------------------------------------------------------------------------------------------------------------------------
Does anyone know what could be causing this.
Thanks
- 05-20-2012, 06:49 PM #2
Re: Inheritance
Where is the constructor defined that takes two Strings for that class?"Cannot find symbol - constructor ClassPerson (java.lang.String, java.lang.String)"
Please post the full text of the error message that shows where the error occurs.If you don't understand my response, don't ignore it, ask a question.
- 05-20-2012, 08:03 PM #3
Re: Inheritance
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Help with inheritance
By waker3210 in forum Java GamingReplies: 6Last Post: 05-19-2012, 08:27 PM -
using inheritance
By droidus in forum New To JavaReplies: 1Last Post: 10-18-2011, 02:38 AM -
JPA Inheritance
By videanuadrian in forum New To JavaReplies: 1Last Post: 01-10-2011, 06:44 AM -
inheritance
By itaipee in forum New To JavaReplies: 6Last Post: 01-20-2009, 08:18 PM -
Inheritance in GUI
By Marty in forum SWT / JFaceReplies: 2Last Post: 05-11-2007, 12:54 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks