• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Constructor Problem

 
Debra Simeroth
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

New problem same program...

I am trying to write a constructor that will refer to another class that I have written. I must be missing something major in the book, which is hard to understand anyway. I get the error "cannot find symbol--constructor employee". As far as I can tell, I am writing the constructor, and have no idea what this error means. Help

 
Henry Wong
author
Marshal
Pie
Posts: 21429
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the error "cannot find symbol--constructor employee". As far as I can tell, I am writing the constructor, and have no idea what this error means. Help



You are listing the code to the PayrollTest class. You need to show us the code for the Employee class -- for us to tell if what issue you are having with the constructor of that class.

Henry
 
Debra Simeroth
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the code for the employee class


 
Henry Wong
author
Marshal
Pie
Posts: 21429
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically, here is the code that you are using to construct an employee object... Notice that you are not passing any parameters...



And here is the code -- for all the constructors in the Employee class...



Do you happen to notice any constructors that don't take any parameters?

Henry
 
Debra Simeroth
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you... when you asked the question, I found the answer...
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Precisely, default constructor will be there, for your service, in the absence of any kind of constructor. Otherwise, you will not get the default constructor once you define any other constructor of that class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic