Is this standard?
-
I've just seen this in some code (CLabel from CodeProject).... i've nver seen syntax like this before but it works!!
m\_monty .SetFontName("Arial") .SetFontSize(12) .SetTextColor(RGB(255,255,0)) .SetFontUnderline(TRUE) .SetBkColor(RGB(0,0,0)) .SetFontItalic(TRUE) .SetFontBold(TRUE) .SetBorder(TRUE) .SetSunken(TRUE);
is this standard C++ or just a vc++ thing? Asim Hussain e: asim@jawache.net w: www.jawache.net
-
I've just seen this in some code (CLabel from CodeProject).... i've nver seen syntax like this before but it works!!
m\_monty .SetFontName("Arial") .SetFontSize(12) .SetTextColor(RGB(255,255,0)) .SetFontUnderline(TRUE) .SetBkColor(RGB(0,0,0)) .SetFontItalic(TRUE) .SetFontBold(TRUE) .SetBorder(TRUE) .SetSunken(TRUE);
is this standard C++ or just a vc++ thing? Asim Hussain e: asim@jawache.net w: www.jawache.net
My guess is that these functions in the CLabel class return a CLabel& . That way you can chain many function calls together in one line (or many lines for that matter). It could also be written as: m_monty.SetFontName("Arial").SetFontSize(12).SetTextColor( etc )...
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
-
I've just seen this in some code (CLabel from CodeProject).... i've nver seen syntax like this before but it works!!
m\_monty .SetFontName("Arial") .SetFontSize(12) .SetTextColor(RGB(255,255,0)) .SetFontUnderline(TRUE) .SetBkColor(RGB(0,0,0)) .SetFontItalic(TRUE) .SetFontBold(TRUE) .SetBorder(TRUE) .SetSunken(TRUE);
is this standard C++ or just a vc++ thing? Asim Hussain e: asim@jawache.net w: www.jawache.net
Yes it's standard. The methods return a reference to an instance of the class. Pavel Sonork 100.15206
-
Yes it's standard. The methods return a reference to an instance of the class. Pavel Sonork 100.15206
Ahhhh...... :-O Asim Hussain e: asim@jawache.net w: www.jawache.net
-
I've just seen this in some code (CLabel from CodeProject).... i've nver seen syntax like this before but it works!!
m\_monty .SetFontName("Arial") .SetFontSize(12) .SetTextColor(RGB(255,255,0)) .SetFontUnderline(TRUE) .SetBkColor(RGB(0,0,0)) .SetFontItalic(TRUE) .SetFontBold(TRUE) .SetBorder(TRUE) .SetSunken(TRUE);
is this standard C++ or just a vc++ thing? Asim Hussain e: asim@jawache.net w: www.jawache.net
This is not the least bit standard. It's the result of someone trying to be cute. Certainly it works - see the other responses for why - but it's pointless.
-
I've just seen this in some code (CLabel from CodeProject).... i've nver seen syntax like this before but it works!!
m\_monty .SetFontName("Arial") .SetFontSize(12) .SetTextColor(RGB(255,255,0)) .SetFontUnderline(TRUE) .SetBkColor(RGB(0,0,0)) .SetFontItalic(TRUE) .SetFontBold(TRUE) .SetBorder(TRUE) .SetSunken(TRUE);
is this standard C++ or just a vc++ thing? Asim Hussain e: asim@jawache.net w: www.jawache.net
It's "cute" coding following the style of STL streams, where you can chain a lot of stuff together like:
cout << "Hello " << "Bob" << endl;
--Mike-- "I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm