overloading <<

Hi guys , I tried to overload the operator << but I have no idea how it works and no idea why it doesn't work .

this is the problem

Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

this is part of my code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public:
		BT();
		bool empty();
		int size();
		bool insert(T, T);	// insert into a BT, a son item if father item is known
		void preOrderPrint();	// print BT node in pre-order manner
		void inOrderPrint();
		void descendingOrderPrint(); // descending print
		int countNode();	// count number of tree nodes
		bool findGrandsons(T);	// find the grandsons of an input father item
		void topDownLevelTraversal();// traverse BT in level by level manner
		void DeepestLevelTraversal();
		bool insert(T);		// insert an item into a BST
		bool remove(T);		// remove an item from a BST
		void clear(BTNode<T>*);
		customer ostream& operator<<(ostream& out,const &customer A);
};


1
2
3
4
5
6
7
8
9
ostream& operator<<(ostream& out,const customer& A){
	out<<A.account<<endl;
	out<<A.name<<endl;
	out<<A.address<<endl;
	out<<A.dob<<endl;
	out<<A.balance<<endl;

	return out;
}


Seriously , will appreciate any help .
Last edited on
customer ostream& operator<<(ostream& out,const &customer A);

Why is there a random "customer" in front of this?
Last edited on
I thought It is necessary to have a return type ?
You already have a return type there though.
Well even though I removed the customer infront I'm still getting nowhere , the error is still there .
operator<< should not be a member of BT.
I moved the code into the customer file , now it says


Error 1 error C2804: binary 'operator <<' has too many parameters
Somehow I moved the function out of the class and it works just like some internet resources said , thanks for all the help though guys .
Topic archived. No new replies allowed.