Note that there are some explanatory texts on larger screens.

plurals
  1. POPlease explain this C++ syntax which seems to be incomplete or lacks assignment?
    text
    copied!<pre><code>reply_form::reply_form() { using cppcms::locale::translate; author.message(translate("Author")); comment.message(translate("Comment")); send.value(translate("Send")); *this + author + comment + send; author.limits(1,64); comment.limits(1,256); } </code></pre> <p>In the given constructor definition, someone please explain what this syntax means or its intended use and benefits:</p> <pre><code>*this + author + comment + send; </code></pre> <p>To me, it appears as if a concatenation/addition which is done without it being assigned to anything, and thats really confusing me as I am not able to understand its purpose.</p> <p>I have made good searches on web with the problem, but probably, I am not using the right term to search for it as I do not know what exactly this type of syntax is termed as.</p> <p>I feel as if its the part of latest C++1x features, but not sure, so not able to find the right book for it. Finally chose stackoverflow for rescue :-)</p> <p>EDIT:</p> <p>the Most relevant I could provide is its declaration in header file, which is:</p> <pre><code>struct reply_form : public cppcms::form { cppcms::widgets::text author; cppcms::widgets::textarea comment; cppcms::widgets::submit send; reply_form(); }; </code></pre> <p>EDIT2:Revision2 (corrected again after checking comments)</p> <p>Ok, I was able to traceback the operator+ thing, and found out the way it was overloaded:</p> <pre><code> inline form &amp;operator + (form &amp;f) { add(f); return *this; } </code></pre> <p>So this was the case of operator overloading. Thanks for your answer. I have been recently migrated to C++ and had found some strange things as I had posted in this thread: <a href="https://stackoverflow.com/questions/6928913/explain-blank-class-functions-in-c">Explain blank class functions in C++</a> which appeared to me as multifunction list with blank body, but later I understood it as a syntax and a way of declaring a variable or calling the base class constructor.</p> <p>Thanks for your answers, it were really helpful and very quick!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload