Author: macaroni
Date: 18:39:56 11/24/03
can you use a pointer to a class? here's a code snippet i'm trying to get to work. #include <iostream.h> struct test { public: int test2,test3; }; int main() { test test1; test1.test2=1; test1.test3=2; test* pointer_to_test1; pointer_to_test1=&test1; (*pointer_to_test1.test2)=3; return 0; } create a pointer to the class test1, then change the value of test1.test2 by using the pointer. Is this possible, this program gives the following warning when compiled in dev-cpp. [Warning]In function 'int main()": request for member 'test2' in pointer_to_test1 thanks
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.