none
In an array of objects, are the objects automatically set to null? RRS feed

  • Question

  • When an array of objects is declared, are the objects automatically set to null?

    For example...

    private CDxfFile[] m_DxfFiles = new CDxfFile[m_ikNumChars];
    
    ...is each m_DxfFiles[n] null until I explicity put something in it?


    http://www.ransen.com Cad and Graphics software

    Saturday, September 22, 2018 7:28 AM

Answers

  • Hello Owen,

    1. Yes. They are all set to NULL (the default value).

    2. You have to explicitly instantiate each array item to a new CDxfFile class.

    - Bio.


    Please visit my blog : http://limbioliong.wordpress.com/

    • Proposed as answer by Ante Meridian Saturday, September 22, 2018 8:28 AM
    • Marked as answer by Owen Ransen Saturday, September 22, 2018 8:59 AM
    Saturday, September 22, 2018 8:07 AM

All replies

  • Hello Owen,

    1. Yes. They are all set to NULL (the default value).

    2. You have to explicitly instantiate each array item to a new CDxfFile class.

    - Bio.


    Please visit my blog : http://limbioliong.wordpress.com/

    • Proposed as answer by Ante Meridian Saturday, September 22, 2018 8:28 AM
    • Marked as answer by Owen Ransen Saturday, September 22, 2018 8:59 AM
    Saturday, September 22, 2018 8:07 AM
  • Thanks Lim!


    http://www.ransen.com Cad and Graphics software

    Saturday, September 22, 2018 8:59 AM