-
#define
Danny Kalev <dannykk@inter.net.il> wrote:
>first of all, if you want to create an array of elements, data should
>be declared
>
>type *;
>
>Secondly, allocate it as usual:
>
>Vector::Vector(int size)
>{
> if (size>0)
> type = new type[size];
>}
>
>Danny
>Aleks wrote:
>>
>> Please,
>> tell me why this code isn't right:
>>
>> template<class type>
>> class Vector{
>> type (*data)[];
>> ...
>> public:
>> //here will be constructor&destructor
>> ...
>> // error appears in this place
>> type* operator[](int i){return data[i];}
>> };
>>
>> And one more question:
>> How to allocate 'data' ?
>>
>> Thank you.
how can i write something with definewich will be dinamic, wich i could
replace in process
example
#define a(x) x*x
int d;
d=5;
a(d);
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
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|