Hi all,
I am trying to create a tool which contains part#, Part Description, Price and Qty. From what I defined I want it to calculate the total price (price*qty) and have it output those 4 data members and the invoice. But I am getting errors on my code. I feel I am not setting up my constructor properly for strings...
invoice.cpp: In constructor ‘invoice::invoice()’:
invoice.cpp:18:12: error: invalid use of member function (did you forget the ‘()’ ?)
m_partNum = "0";
^
invoice.cpp:19:13: error: invalid use of member function (did you forget the ‘()’ ?)
m_partDesc = "0";
^
invoice.cpp:20:8: error: invalid use of member function (did you forget the ‘()’ ?)
m_qty = 0;
^
invoice.cpp:21:10: error: invalid use of member function (did you forget the ‘()’ ?)
m_price = 0;
^
invoice.cpp: In constructor ‘invoice::invoice(std::string, std::string, int, double)’:
invoice.cpp:27:13: error: invalid use of member function (did you forget the ‘()’ ?)
m_partNum = partNum;
^
invoice.cpp:28:14: error: invalid use of member function (did you forget the ‘()’ ?)
m_partDesc = partDesc;
^
invoice.cpp:29:9: error: invalid use of member function (did you forget the ‘()’ ?)
m_qty = reqQty;
^
invoice.cpp:30:11: error: invalid use of member function (did you forget the ‘()’ ?)
m_price = reqQty;
^
invoice.cpp: At global scope:
invoice.cpp:36:14: error: ‘account’ has not been declared
constdouble account::get_invoice() {
^
invoice.cpp: In function ‘constdouble get_invoice()’:
invoice.cpp:37:9: error: ‘m_qty’ was not declared in this scope
return m_qty * m_price;
^
invoice.cpp:37:17: error: ‘m_price’ was not declared in this scope
return m_qty * m_price;
^
invoice.cpp: At global scope:
invoice.cpp:41:6: error: ‘account’ has not been declared
void account::deposit(double amount){
^
invoice.cpp: In function ‘void deposit(double)’:
invoice.cpp:47:3: error: ‘m_balance’ was not declared in this scope
m_balance = m_balance + amount;
^
invoice.cpp: At global scope:
invoice.cpp:53:39: error: no ‘const string invoice::asstring() const’ member function declared in class ‘invoice’
const std::string invoice::asstring() const{
invoice.cpp: At global scope:
invoice.cpp:36:14: error: ‘account’ has not been declared
constdouble account::get_invoice() {
^
invoice.cpp: In function ‘constdouble get_invoice()’:
invoice.cpp:37:9: error: ‘m_qty’ was not declared in this scope
return m_qty * m_price;
^
invoice.cpp:37:17: error: ‘m_price’ was not declared in this scope
return m_qty * m_price;
^
invoice.cpp: At global scope:
invoice.cpp:41:6: error: ‘account’ has not been declared
void account::deposit(double amount){
^
invoice.cpp: In function ‘void deposit(double)’:
invoice.cpp:47:3: error: ‘m_balance’ was not declared in this scope
m_balance = m_balance + amount;
^
Then I get a bunch of these overloaded function errors as seen below
1 2 3 4 5
invoice.cpp: In member function ‘const string invoice::asstring() const’:
invoice.cpp:58:15: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘<unresolved overloaded function type>’)
"Qty : " << m_qty <<
^