linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shriramana Sharma <samjnaa@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Errors with ->*
Date: Tue, 02 Aug 2011 22:01:02 +0530	[thread overview]
Message-ID: <4E382646.7060903@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

Hello -- long time since I posted on this list.

I'm trying to understand the use of ->* but in compiling the attached 
program which I thought was straightforward I am getting the following 
errors:

foo.cpp: In constructor ‘mystruct::mystruct()’:
foo.cpp:9:12: error: invalid conversion from ‘int*’ to ‘int’
foo.cpp: In function ‘int main()’:
foo.cpp:21:7: error: ‘xptr’ was not declared in this scope
foo.cpp:22:7: error: ‘yptr’ was not declared in this scope

Please help.

-- 
Shriramana Sharma

[-- Attachment #2: foo.cpp --]
[-- Type: text/x-c++src, Size: 284 bytes --]

struct mystruct 
{
public:
	int x, y ;
	int * xptr, yptr ;
	mystruct () 
	{ 
		xptr = & x ; 
		yptr = & y ; 
	}
} ;

int main ( void )
{
	mystruct a ;
	mystruct * aptr = & a ;

	a . x = 1 ; 
	a . y = 2 ;

	a .* xptr = 3 ;
	a .* yptr = 4 ;

	aptr ->* xptr = 5 ;
	aptr ->* yptr = 6 ;
}

             reply	other threads:[~2011-08-02 16:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 16:31 Shriramana Sharma [this message]
2011-08-02 16:54 ` Errors with ->* Aniruddha Bhattacharyya
2011-08-02 16:55   ` Aniruddha Bhattacharyya
2011-08-02 17:47 ` Darío Mariani
2011-08-02 20:52 ` Glynn Clements
2011-08-03  3:57 ` Shriramana Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E382646.7060903@gmail.com \
    --to=samjnaa@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).