Reputation: 13
#include"EAN.h"
class Order{
private:
EAN ean_object;
int no_copies;
int no_delivered;
public:
Order();
Order(const EAN& ean);
EAN& getEAN();
int outstanding() const;
bool add(std::istream& is);
bool add(int n);
bool receive(std::istream& is);
void display(std::ostream& os) const;
};
std::ostream& operator<<(std::ostream& os, const Order& order);
This is my header file. When i am defining the EAN& getEAN()
function as Order::EAN& getEAN()
. Its showing error as no type name EAN
in Order
class? How to define it?
Upvotes: 0
Views: 63
Reputation: 44444
When i am defining the
EAN& getEAN()
function asOrder::EAN& getEAN()
You have to define it as:
EAN& Order::getEAN()
In other words, getEAN()
is a function within the class Order
. It is erroneous to say EAN
is a member of the Order
class.
Upvotes: 4
Reputation: 310980
I think you mean
EAN& Order::getEAN() { /* ... */ }
instead of
Order::EAN& getEAN() { /* ... */ }
That is member function getEAN itself indeed is declared in class Order while type EAN is not defined in class Order though it is used in the class Order definition.
Upvotes: 1