fork download
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. class Date
  6. {
  7. int day;
  8. int month;
  9. int year;
  10. public:
  11. Date (int Day=1, int Month=1, int Year=1970)
  12. {
  13. day = Day;
  14. month = Month;
  15. year = Year;
  16. }
  17. int getDay() {return day;}
  18. int getMonth() {return month;}
  19. int getYear() {return year;}
  20. };
  21.  
  22. /*InventoryItem containing Name, Cost, Quantity, DatePurchased(Object of the date Class), InventoryTotal(Static Variable)*/
  23. class InventoryItem
  24. {
  25. string Name;
  26. double Cost;
  27. int Quantity;
  28. Date DatePurchased;
  29. static int InventoryTotal;
  30.  
  31. public:
  32. InventoryItem (string strName, double dCost, int nQuantity, Date cDatePurchased(int, int, int), int s_nInventoryTotal)
  33. {
  34. Name = strName;
  35. Cost = dCost;
  36. Quantity = nQuantity;
  37. DatePurchased = cDatePurchased(10,10,2010);
  38. InventoryTotal = s_nInventoryTotal;
  39. }
  40. string getName() {return Name;}
  41. double getCost() {return Cost;}
  42. int getQuantity() {return Quantity;}
  43. Date getDatePurchased() {return DatePurchased();}
  44. int getInventoryTotal() {return InventoryTotal;}
  45. };
  46.  
  47. int main ()
  48. {
  49. //InventoryItem.cDatePurchased(10,10,2010);
  50. cout << InventoryItem.getDatePurchased();
  51. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function 'Date InventoryItem::getDatePurchased()':
prog.cpp:43:51: error: no match for call to '(Date) ()'
prog.cpp: In function 'int main()':
prog.cpp:50:26: error: expected primary-expression before '.' token
stdout
Standard output is empty