I've taken this example from docs.Microsoft
Can't I initialize these data members at first place?Code:public class Person { private string last; private string first; public Person(string lastName, string firstName) { last = lastName; first = firstName; } // Remaining implementation of Person class. }
Then why using Constructor?




Reply With Quote
