About 11,500,000 results
Open links in new tab
  1. C++11 member initializer list vs in-class initializer?

    Dec 8, 2014 · The expression-list or braced-init-list in a mem-initializer is used to initialize the designated subobject (or, in the case of a delegating constructor, the complete class object) according to the …

  2. Use of Initializers vs Constructors in Java - Stack Overflow

    Apr 30, 2009 · Static and Instance Initializers are two such techniques. My question is when would one use an initializer instead of including the code in a constructor? I've thought of a couple obvious …

  3. I'm getting "Invalid Initializer", what am I doing wrong?

    3 An initializer for a char[] needs to be either a literal string or something like {1,2,3,4}. It isn't allowed to be the name of another variable.

  4. What is a designated initializer in C? - Stack Overflow

    Aug 15, 2022 · The Designated Initializer came up since the ISO C99 and is a different and more dynamic way to initialize in C when initializing struct, union or an array. The biggest difference to …

  5. java - What is an initialization block? - Stack Overflow

    Oct 21, 2010 · We can put code in a constructor or a method or an initialization block. What is the use of initialization block? Is it necessary that every java program must have it?

  6. How to initialize a struct in accordance with C programming language ...

    Designated Initializer The Designated Initializer came up since the ISO C99 and is a different and more dynamic way to initialize in C when initializing struct, union or an array. The biggest difference to …

  7. C++ a member with an in-class initializer must be const

    Nov 7, 2012 · Another thing that might affected that design in the compiler is that the C++11 standard allows for initializers in the declaration of non-static members of a class, which will then be used in …

  8. c++ - Initializing fields in constructor - initializer list vs ...

    The first one is the recommended best practice, as it is more idiomatic and avoids re-initializing fields for types which do have a default constructor (i.e. non-primitive types). When you only initialize a …

  9. c - Error "initializer element is not constant" when trying to ...

    return 0; } constchar.c:3:21: error: initializer element is not constant const char * str2 = str1; In fact, a "const char *" string is not a compile-time constant, so it can't be an initializer. But a "const char * …

  10. c# - What's the difference between an object initializer and a ...

    An object initializer is code that runs on an object after a constructor and can be used to succinctly set any number of fields on the object to specified values. The setting of these fields occurs after the …