The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Optional non-const reference argument c++ ? johnbach High Level Programming 2 09-17-2009 10:40 AM
cast from const void* to unsigned int loses precision mannam srinivas Red Hat 0 08-08-2008 01:15 AM
int open(const char *pathname, int flags, mode_t mode) doubt... csnmgeek UNIX for Dummies Questions & Answers 2 11-15-2007 01:41 PM
diff b/w char const in C/C++ sarwan High Level Programming 3 10-11-2005 02:14 AM
Reference to a const arun.viswanath High Level Programming 1 09-05-2005 06:20 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 4 Weeks Ago
eager2no eager2no is offline
Registered User
  
 

Join Date: Oct 2008
Location: Chicago
Posts: 11
Questions about const

Hi all,

I have some questions about functions.
In a code I have (a .hpp file) there is this line which says:
Code:
const Class_1_Name* Class_2_Name::MethodName(int ipart) const {return (ClassName*)_ref_to_method.At(ipart);}
My questions are:

  • What is the meaning of the two constants, especially the second one? What do they do exactly? (general meaning of course)
  • Why do we use a reference to the method and not the method itself [as in: _ref_to_method.At(ipart)]

Thank you in advance,

~eager
  #2 (permalink)  
Old 4 Weeks Ago
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,929
The second 'const' means that this member is not allowed to modify any values inside the class Class_2_name.

I am unable to divine the meaning of your second question. I do not recognize the _ref_to_method macro/operator/extension and don't understand what it's supposed to do... A reference to a method is pretty useless without a reference to its object in any case.
  #3 (permalink)  
Old 4 Weeks Ago
eager2no eager2no is offline
Registered User
  
 

Join Date: Oct 2008
Location: Chicago
Posts: 11
Thank you for the answer and apology for not replying back sooner.

by ref_2_method, I mean a reference to the method mentioned by MethodName. I will try to see if it is possible to show part of this code.

Thank you so much again,

~eager
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0