even though it makes use of the examples,doing elaborate yet simple things to show the languages flexibility at around page 90,give or take, it cuts the explainations short
Although the prototype of a function operator+ can seem obvious since it takes what is at the right side of the
operator as the parameter for the operator member function of the object at its left side, other operators may not
be so obvious. Here you have a table with a summary on how the different operator functions have to be declared
its now official and im not being ungrateful the more i went on the less i understood. maybe your tut is right for someone but its not me atleast now i know the basic concept im going to try and find a next one or a book any suggestions
i was looking at the c++ programming language by bjourne styrup
Have you had a rest break? ;) People do need to sleep to assimilate knowledge.
zander wrote:
i was looking at the c++ programming language by bjourne styrup
I bought that book as it was in my courses "suggested reading" list. I found it overly complicated and bulky in places. You might want to try a C++ For Dummies book, or Sam Teach Yourself C++ (in a ridiculous amount of time). They're written with beginners in mind.
oh i eventually came to understnd it i did need a break any way i wrote this and even though i can prob tell u whats wrong with it and how to fix it i just wanted to know if u guys were thinking my solution/answer also
#include <iostream>
using namespace std;
class add{
public:
int x=5;
int y=8;
int operater+(add);
};
int add::operator+(add b)
{
add temp;
temp=a.x+b.x;
return(temp);
}
int main()
{
add a,b;
cout<<a.x+b.x<<endl;
return 0;
}