Thursday, July 30, 2009

What do these types of expressions mean in C++?

pDel -%26gt; setGE (1,1,0,0,0)





and





sABC.cHd.setSpaceCenter ((int)(0.5 *pProtocol -%26gt; Space().myvalue() ) );








also what do these types of declarations mean:





static sPHASE sDC ("sInputArg")





Is the function sDC being declared as type sPHASE?





thanks

What do these types of expressions mean in C++?
pDel -%26gt; setGE (1,1,0,0,0)


means invoke function setGE function in the class to which pDel is a pointer.





sABC.cHd.setSpaceCenter ((int)(0.5 *pProtocol -%26gt; Space().myvalue() ) ); means invoke the member function of the class of which cHd is declared to be an object. i.e: some where in your code you would have declared a variable cHd to be a class object, and you are invoking the function setSpaceCenter() with the arguments:


return value of pProtocol-%26gt;Space().myvalue() i.e: convert the return value of function Space() using the member function myvalue(), multiply it with 0.5 (gives a float value) then cast it to int.


the final value of this cast is given as input argument to setSpaceCenter().





statis sPHASE sDC("sInputArg");


means a class object sPHASE of class type sDC taking a single input to it's constructor "sInputArg" has been declared to be static, i.e; you don't need to call the constructor of that class to use sPHASE, you can simply call the variable


cout %26lt;%26lt; Someclass::sPHASE


or any such other use.

online florist

No comments:

Post a Comment