I'm getting an error saying "Debug Assertion Failed!" whenever i try to run this program in VC++ :
getSalary :Code:#include <iostream> using std::cout; using std::cin; using std::endl; #include "employee.h" int main(void) { Employee *emp[1]; emp[0] = new Employee("firstname", "lastname", 9090); cout << emp[0]->getSalary(); delete [] *emp; return 0; }
Why am i getting this error? and how do i fix it?Code:int Employee::getSalary() const { return salary; }
note : this is a small sample to show the problem.
*EDIT* btw , the class works fine with objects and pointer to object. So i'm guessing its the way i used the array.
your help is appreciated