Wrox Programmer Forums
|
BOOK: Professional C++, 2nd Edition
This is the forum to discuss the Wrox book Professional C++, 2nd Edition by Marc Gregoire, Nicholas A. Solter, Scott J. Kleper ; ISBN: 978-1-1181-6995-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C++, 2nd Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 3rd, 2012, 05:42 PM
Registered User
 
Join Date: Mar 2012
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
Default About code on page 182

Bonjour,
On the top of the page 182, in the fisrt code snippet, one of the line reads :

int getId() const;

I have issue with this specific line
Indeed I do not understand the use of "const" on this line
Could one of you help me understand the line (I may have missed one point somewhere)

Best regards, Philippe
 
Old March 3rd, 2012, 06:05 PM
Registered User
 
Join Date: Mar 2012
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
Default

Forget my question
I knew it was a bad idea

Const is there because getId is an Inspector
See p 33 for details if needed

Sorry for the post.
Regards, Philippe
 
Old March 4th, 2012, 11:30 AM
Wrox Author
 
Join Date: Mar 2011
Posts: 49
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Correct, getId() is an inspector and does not change any data members of the class, so it's const.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to save html page source code? Jaymond Flurrie Access VBA 2 July 2nd, 2019 06:04 PM
Chapter 5 Pages 182 to 183 Constructors epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 October 2nd, 2009 02:39 PM
On page 182 tedr BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 0 March 28th, 2009 07:19 PM
Master Page Method: Code-Behind for Content Page kwilliams ASP.NET 2.0 Professional 3 June 2nd, 2008 12:57 PM
Errata page 182 tpangborn BOOK: Ivor Horton's Beginning Visual C++ 2005 0 May 21st, 2006 09:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.