In what scenario would you initialise class variables in constructors and when without constructor?
class CustomList
{
public Node head;
public int count;
public CustomList()
{
head = foo;
count = 1;
}
}
Or
class CustomList
{
public Node head =foo;
public int count =1;
}