I am a Java programmer who is trying to teach me C ++. If I have to ask first question, please let me loose a bit.
I would like to understand how the operator of the structure works. In particular, can someone tell me what the following line of code does in clear words? If (element [i] -> test (arga, argb)) {}
test (arga, argb) is a boolean function Examples of the same class, and element element squared is a vector. Here is the code that immediately encircles the above line, which I'm interested in:
for (unsigned i = 0; i test (arga, argb)) {// some code}} it seems that if the line is testing to see whether the bullion returned or not tested (arga, argb) Element is part of the example given by the class. But when I try to highlight the basic values of the above cout lines of elements [i] or test (arga, argb), the compiler throws errors until I comment out those lines. In Java, I would be able to fiddle around it until I could not meet the values of each other, and then I would understand the code line. But I do not know what this line of code does in C ++. Does anyone give me a clear explanation, which can be linked to some references or more than two supported?
element [i] - & gt; Exam (arga, argb)
If we break the statement, from left to right , we will end up with: < Ol> Use the i element in an array (or array-like ) element element < / Li> The element's access ( element [i] ) is an indicator for an object member-function designated test on the element [i] and pass it two arguments; RGA and argb
If we ignore the fact that you have written std :: cout & Gt; & Gt; std :: cout & lt; & Lt; Instead of (the next is the correct form), we conclude the two of the errors mentioned by you: -
About your compiler std :: Cout & lt; & Lt; Element [i] because element [i] and std :: ostream & amp; There is no appropriate overload (which is the underlying type of std :: cout ) to control the type of . -
Your compiler is std :: cout because test has no function in the scope of the name, which is arga, argv test code , in your snippet, an member-function that comes under a single unit, calling it by itself Deserving Is not.
No comments:
Post a Comment