constructor called twice

This is a discussion on constructor called twice within the C++ Programming forums, part of the General Programming Boards category; hi I found two statements in a working program which calls constructor twice. The first statement creates an object by ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    32

    constructor called twice

    hi
    I found two statements in a working program which calls constructor twice.
    The first statement creates an object by calling two argument constructor.
    In the second statement the same object calls one argument constructor.

    The statements are below

    Code:
    1. for_fft_type for_fft(Domain<1>(nrange), 1.0);
    2. for_fft(replica);
    is this legal .please explain
    thank u

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    I don't think the compiler allows that. It is possible that the second line actually calls the overloaded operator().
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    32
    Thank u anon
    you r right .It is overloaded operator().

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21