linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Errors with ->*
@ 2011-08-02 16:31 Shriramana Sharma
  2011-08-02 16:54 ` Aniruddha Bhattacharyya
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Shriramana Sharma @ 2011-08-02 16:31 UTC (permalink / raw)
  To: linux-c-programming

[-- 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 ;
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-03  3:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-02 16:31 Errors with ->* Shriramana Sharma
2011-08-02 16:54 ` 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

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).