ok, what i have is a parent class, eployee, with 5 child classes, Doctor Surgeon Nurse Janitor and Receptionist. on my form i have a buttongroup for when the user selects one of those 5 jobs. when the user selects one i want to create an instance of that object, but i only want to have one variable such as that when the user selects a job that variable is then used to create an instance of 5 possible jobs, so far that works with using the variable Object job; declared globally, but when i got to use a method in the specified class it says that java.lang.object does not have the corresponding method. Im asking for how to create a variable that can store different object and still use that object's methods.
slayer10
0
Light Poster
Recommended Answers
Jump to Postin your child classes did you extend object?
Jump to Posthmm..
can you show me part of your code? say one of the classes and how your initializing the object.
Jump to PostYour child class should extend object... unless employee does? try doing that... the odd thing is that technically everything is an object right?
Jump to PostTry testing it without using the employee class. does it still give you that error?
All 13 Replies
nschessnerd
0
Posting Whiz in Training
slayer10
0
Light Poster
nschessnerd
0
Posting Whiz in Training
slayer10
0
Light Poster
nschessnerd
0
Posting Whiz in Training
slayer10
0
Light Poster
nschessnerd
0
Posting Whiz in Training
slayer10
0
Light Poster
darkagn
315
Veteran Poster
Featured Poster
darkagn
315
Veteran Poster
Featured Poster
nschessnerd
0
Posting Whiz in Training
slayer10
0
Light Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.