|
-
May 9th, 1999, 10:39 PM
#1
C++ class
I have a problem with classes of c++;
eg.
typedef struct tag{
char *ppp;
}X;
class Y
{
X *exx;
char *yyy;
};
i want to access members of X through Y
eg. Y *yyy;
now i want to access ppp , how do i access it?or how do i make a pointer to X?
Fast reply appreciated
Tapan
-
May 10th, 1999, 01:27 AM
#2
Re: C++ class
First of all, you must create an instance of class Y
Y *yyy = new Y;
Now, you must connect member pointer 'exx' to real object of type X, i.e.
yyy->exx = new X;
And now, you must connect member pointer 'ppp' to real data
yyy->exx->ppp = new char[16];
strcpy(yyy->exx->ppp, "BlahBlahBlah");
Hope this helps. If not, or you have any questions, write me to [email protected]
(Sorry for my bad english)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|