Initializing member arrays in constructors

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
ImLazy
Experienced poster
Posts: 215
Joined: Sat Jul 10, 2004 4:31 pm
Location: Shanghai, China

Initializing member arrays in constructors

Post by ImLazy »

In this code:

Code: Select all

class C {
    int a[10];
    int b;

    C(): b(1) {}
}
Is there any way to initialize the array a in the constructor like the ":b(1)"? I tried "a({0})" and "a(0)" but failed.
I stay home. Don't call me out.

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

No.

Post Reply

Return to “C++”