I
I
ichernob2015-08-18 13:22:59
C++ / C#
ichernob, 2015-08-18 13:22:59

Why does the object refer to null after the constructor is called?

There is a class

...
protected class InitialValues
{
    //тут только свойства
}
...
private InitialValues initialValues;
...

After the constructor is called, the
initialValues = new InitialValues();
initialValues ​​instance refers to null. How can this be?
PS I will also add that this class has several heirs, if it is important.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
V Sh., 2015-08-18
@JuniorNoobie

InitialValues initialValues = new InitialValues();

S
Sergey Mozhaykin, 2015-08-18
@smozhaykin

Show where you call Initialize() from, what class you are instantiating (parent, child, etc.), whether the successor overrides Initialize...
You may have overridden Initialize in the child, you call it, and therefore initialValues ​​remains null.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question