2
Overloading Operator Operator overloading is a very neat feature of object oriented programming Operator overloading allows it to give normal C++ operators such as +,-,==,< additional meanings It makes statements more intuitive and readable for example: Date d1(12,3,1989); Date d2; d2.add_days(d1,45); // can be written with the + operator as d2=d1+45;

11
Non-Member Function Operator Operators can also be implemented as non-member functions instead of member functions However this approach is usually not recommended as member data is private to the operator Necessary for some operators in which the class object does not appear on the left hand side of the operator for example >

14
Overloading << Operator Overloading the << operator allows you to specify the way in which an object is displayed As the << operator expects a stream object as the left hand argument it must be overloaded as a non-member function : ostream& operator<
{
"@context": "http://schema.org",
"@type": "ImageObject",
"contentUrl": "http://images.slideplayer.com/11/3314832/slides/slide_14.jpg",
"name": "Overloading << Operator Overloading the << operator allows you to specify the way in which an object is displayed As the << operator expects a stream object as the left hand argument it must be overloaded as a non-member function : ostream& operator<

16
Friend Mechanism The friend mechanism is useful when some function has to operate with two classes simultaneously so that it can not be a member function of both classes at the same time class Matrix; // declares that class Matrix exists somewhere class Vector { double v[4]; friend Vector operator* (const Matrix&m, const Vector& v); }; class Matrix{ Vector v[4]; friend Vector operator* (const Matrix&m, const Vector& v); };

21
Templates A template is a place-holder for an arbitrary built-in or user-defined data type Templates make is possible to use one function or class to handle many different data types Function templates allow a parameter to assume an arbitrary data-type Class templates allow a member data to assume an arbitrary data-type Templates are another example for polymorphism