Thread View: comp.std.c++
1 messages
1 total messages
Started by C M Chan
Wed, 30 Dec 1992 17:18
Array in class
Author: C M Chan
Date: Wed, 30 Dec 1992 17:18
Date: Wed, 30 Dec 1992 17:18
36 lines
1210 bytes
1210 bytes
Hi out there,
I am sorry if this is faq for this newsgroup. Here is my question:
How can I simulate "pointer to char" by an array in a class whose size will be delayed to be
defined at run time?
For example,
class X {
private:
char string[ ]; /* not define size of the array */
^^^^^^^^
public:
X(int);
...............
};
X::X(int size) {
string[size]; /* define size of string array now */
strcpy(string, "Hello");
}
Any pointer to this problem will be greatly appreciated. Thanks in advance.
--
C M CHAN cmchan@dcs.warwick.ac.uk
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads