Boost logo

Boost Users :

From: Colin Rafferty (colin.rafferty_at_[hidden])
Date: 2004-02-26 09:02:46


voodoo4_at_[hidden] wrote:
> Colin Rafferty wrote:

>> class Master
>> {
>> // ...
>> shared_array<Slave> sl;
>> };
>>
>> Master::Master(int val)
>> : sl(new Slave[val])
>> {
>> }
>>
>> Master::~Master()
>> {
>> // intentionally left blank!
>> }
>
> It works.Thanks!
> However i'm still having a problem understanding how i'm going to
> initialize the Slave array in some other function rather than in
> initialization, and keep the scope
> public for the whole Master object(excuse my terminology,i'm not english).

Just like initializing anything else in a different function.

    extern shared_array<Slave> createSharedArray();
    
    Master::Master(int val)
        : sl(::createSharedArray())
    {
    }

-- 
Colin

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net