Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 having a class as a member of one structure...
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Tue Jul 08, 2003 11:04 pm   Post subject: having a class as a member of one structure...

let's say i have created some class and named it MyClass;
and now i'm creating a structure like this

code:
typedef struct _MONEY {     
double x,y,z;
MyClass Class_1;                               
} MONEY;


Is that possible?
Sponsor
Sponsor
Sponsor
sponsor
UBC_Wiskatos




PostPosted: Tue Jul 08, 2003 11:15 pm   Post subject: Re: having a class as a member of one structure...

Homer_simpson wrote:
let's say i have created some class and named it MyClass;
and now i'm creating a structure like this

code:
typedef struct _MONEY {     
double x,y,z;
MyClass Class_1;                               
} MONEY;


Is that possible?


Most definitely yes, just be sure to include the header of the other class, if you follow that organization style.
Homer_simpson




PostPosted: Wed Jul 09, 2003 12:07 am   Post subject: (No subject)

hmmm... then there must be something wrong with my coding... since the structure wont take it as a member Confused
rizzix




PostPosted: Wed Jul 09, 2003 2:57 am   Post subject: (No subject)

try MyClass *myclassobj;
yea use a pointer of type MyClass
Homer_simpson




PostPosted: Wed Jul 09, 2003 1:28 pm   Post subject: (No subject)

nah... didn't need pointer i got it working now...
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: