Wednesday, November 21, 2007

Can Flagyl Be Used For Chest Infections

const to infinity and beyond ..

Certainly for those of you who studied the C + +, the const keyword that follows the header of a function, you know that signals being a function that does not change the members of the class. However, since the C + + is a language that allows you to do many things (not always right) you can go and change fields in a class. We see the following example: # include


using namespace std;


class Test {private: string
untouchable;

public:
Test () {untouchable = "hello";}

void print () {court << intoccabile << endl; }

funzioneCostante void () const {
Test * thisNonCostante = const_cast (this);
thisNonCostante-> = untouchable "Toccata";

}};


int main () {

Test spiaPrivate;

spiaPrivate.print ();
spiaPrivate.funzioneCostante ();
spiaPrivate.print ();
return 0;}


Note: L ' const_cast operator is to be used with extreme caution.

0 comments:

Post a Comment