CXTPReportRecordItem::GetTooltip() and const |
Post Reply |
Author | |
zitz
Senior Member Joined: 05 October 2008 Status: Offline Points: 112 |
Post Options
Thanks(0)
Posted: 28 November 2009 at 9:29am |
For what added const? (everywhere where it is called, it is not const)
I overload CXTPReportRecordItem::GetTooltip() and I can not call from it GetCaption for example |
|
Xtreme ToolkitPro v13.1.0, static, VC++6
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Why "added" -
ver 12.1:
//-----------------------------------------------------------------------
// Summary:
// Returns the text tool tip for the item
// Returns:
// The text tool tip for the item.
//-----------------------------------------------------------------------
virtual CString GetTooltip() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to set/change the item tool tip.
// Parameters:
// lpszTooltip - Tool tip of the item
//-----------------------------------------------------------------------
virtual void SetTooltip(LPCTSTR lpszTooltip);
|
|
zitz
Senior Member Joined: 05 October 2008 Status: Offline Points: 112 |
Post Options
Thanks(0)
|
My question is: why "const"?
|
|
Xtreme ToolkitPro v13.1.0, static, VC++6
|
|
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
|
Because GetTooltip does not change the content of the class!
Take a look at good C++ books about 'const correctness', e.g. 'Exeptional C++'... If you really need a non-const version, you can cast the const away (const_cast<>), but this is not recommended. |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
zitz
Senior Member Joined: 05 October 2008 Status: Offline Points: 112 |
Post Options
Thanks(0)
|
Martin, I know that this is not recommended (I am a little know C++ ) - Because of this I made a post on this forum.
Who said that GetTooltip does not change the content of the class? It is virtual and i want to change the content! Does GetCaption change the content of the class? But it is not const! I only told library's developers about the architectural limitations. |
|
Xtreme ToolkitPro v13.1.0, static, VC++6
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |