opeartor is a function just like any other,
it has return type, arguments and body where function identifer is "operator" with operator added like "operator++"
operator inside a class is defined for this object.
operator outside the class is defined for any operands.
Oh i only pasted partial of the class due to a huge program i have. Anyway is it mandatory to friend it?
I need to overload the << operator for 4 diffrent classes. And the algorithm of output will be diffrent
Before i print the class do i have to do this all the time?
pd.operator<<(cout);
No you don't.
I've edited my previous post with another "way", so you probably didn't se that.
also, is cin.ignore() mandatory? if so why?
it's not mandatory but it's recomended because system("pause") is for windows only, thus your code becomes unportable to other platforms.
while cin.ignore(); is C++ standard and works on any platform.
also system("pause") sims to have some security wholes but I don't know much about that.
also when you use system("pause") then others think that you're noob, but I wouldn't say that.