I've learned C# over the course of the past 6 months or so and am now delving into Java. My question is about instance creation (in either language, really) and it's more of a I wonder why they did it that way. Take this example
Person Bob = new Person();
Is there a reason that the object is specified twice? Would there ever be a something_else Bob = new Person()?
It would seem if I were following on from convention it would be more like
int XIsAnInt; Person BobIsAPerson;
Or perhaps one of these: Person() Bob; new Person Bob; new Person() Bob; Bob = new Person();
I suppose I'm curious if there's a better answer than "that's just the way it is done"
Aucun commentaire:
Enregistrer un commentaire