Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Using (return val of) member function as default parameter of member function
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Neil Butterworth  
View profile  
 More options Nov 6, 5:27 pm
Newsgroups: comp.lang.c++.moderated
From: Neil Butterworth <nbutterworth1...@gmail.com>
Date: Fri, 6 Nov 2009 16:27:01 CST
Local: Fri, Nov 6 2009 5:27 pm
Subject: Re: Using (return val of) member function as default parameter of member function

Djm wrote:
> Hello.

> Is it not possible to use (the return value of one member function)
> as  default value for a parameter in another member function of the
> same class? For example In the code below I was suprised to get the
> compiler error

> "error: cannot call member function ‘tBcPins* tBcPinMan::allPins()’
> without object"

It's not very suprising - there is no object to call the function on.
The "this" pointer is on;y available in the body of the function.

> If its not possible is there any decent "hack" or alternative to do
> achieve the same.

Make the allPins() function static.

Neil Butterworth

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google