Constructor?
If i have a bool variable called "bool IsNew = false" and i have a class called customers....If i have a constructor like
public Customers()
{
IsNew = True;
}
Is adding this in my constructor say that every time this class is loaded...IsNew is true?
(Was this a real post or somekind of a joke...?)
Yes, constructor sets the value of the IsNew to true for every Customer object that is initialized. You can also define InNew to true. private bool isNew = true;
Assuming that is the only constructor, then Yes, IsNew will always be initially set to true.
OF course, you can design more that one constructor, and if you were to define one like :
public Customer(String name)
{
this.Name = name;
}
without resetting IsNew, then IsNew will retain it's first value of false.