You need to sign in to do that
Don't have an account?
Shilpa Srikantachar
Constructor not defined error
Hi All ,
I'm getting the Execute Anonymous Error
Line: 1, Column: 18
Constructor not defined: [Employee_Info].<Constructor>(String, Integer
public class Employee_Info {
when the following code is run :
public String name;
public Integer exp;
public Decimal salary;
public Decimal bonus;
public Employee_Info(String empName,Integer empExp){
name=empName;
exp=empExp;
}
public void invoke(){
if(exp > 5){
salary=50000;
bonus=5000;
}else{
salary=30000;
bonus=3000;
}
}
public void show(){
System.debug('Name :'+name);
System.debug('Exp :'+exp);
System.debug('Salary:'+salary);
System.debug('Bonus:'+bonus);
}
}
Pls let me know how to fix it .
Thanks
Shilpa
I'm getting the Execute Anonymous Error
Line: 1, Column: 18
Constructor not defined: [Employee_Info].<Constructor>(String, Integer
public class Employee_Info {
when the following code is run :
public String name;
public Integer exp;
public Decimal salary;
public Decimal bonus;
public Employee_Info(String empName,Integer empExp){
name=empName;
exp=empExp;
}
public void invoke(){
if(exp > 5){
salary=50000;
bonus=5000;
}else{
salary=30000;
bonus=3000;
}
}
public void show(){
System.debug('Name :'+name);
System.debug('Exp :'+exp);
System.debug('Salary:'+salary);
System.debug('Bonus:'+bonus);
}
}
Pls let me know how to fix it .
Thanks
Shilpa
Employee_Info EI = new Employee_Info('Test', 10);
EI.Invoke();
EI.Show();
As a best practice, local varriable should be defined as Private.
All Answers
Employee_Info EI = new Employee_Info('Test', 10);
EI.Invoke();
EI.Show();
As a best practice, local varriable should be defined as Private.
Pertaining to which local varaiable you are suggesting as Private .
public Integer exp;
public Decimal salary;
public Decimal bonus;