Information générale
Catégorie:
Code, syntaxe and commandes
Titre:
C# discussion: Redundant class names?
This is the first in what I think will be a series of discussions relating to C#. I am immersed in learning it and know others are as well. Or already have, or are thinking about it. Generics and interfaces are a couple of topics I have in mind after I get a question that has been bugging me for a while out of my system. The answer is probably blindingly obvious to someone who already knows C#.
Here is my question. When you instantiate an object, you do it like this:
Circle cir = New Circle();
Why does the class name occur twice? Why isn't the Circle() on the right sufficient to define the type of object being created?
i.e. Why isn't it? ---
cir = New Circle();
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement