o_O? Like I said, I'm a beginner, so I have no idea what you are talking about...Quote:
Your shop() function could just as well take a structure and you could pass it by reference which would simplify the code a bit and would rid you of the 15 parameters you have to pass. Also just because you can modify a variable passed on the stack does not mean you have to do it this way. If you find you are altering a lot of parameters that are passed to the function you may want to revisit the design.
Shop() only needs the parameters passed by reference if it intends on modifying the parameters. In fact when I see a pass by reference without a const it tells me that the function DOES modify the parameter.
This function very clearly tells the programmer that it will concatenate matrix1 and matrix2 and result will be the result of the concatenation. Matrix1 and Matrix2 are passed by reference to avoid a copy constructor call which would happen if they were passed by value. The const indicates that the function will not modify matrix1 nor matrix2. The lack of const for result clearly indicates to the programmer that result will be modified by the function. What the function prototype does not indicate is the order of operations. Since Matrix1 * Matrix2 != Matrix2 * Matrix1 this function would need a comment specifying the order in which the matrices are concatenated. One could say that since they are labeled as 1 and 2 it would indicate Matrix1 * Matrix2 but there is nothing in the prototype that would beyond a shadow of a doubt indicate the order of concatenation.Code:
void MatrixMultiply(Matrix &result,const Matrix &matrix1,const Matrix &matrix2)
Note that this function is a bit unwieldy since it cannot be used as an rvalue which would be quite handy.