Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Constructor overloading
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01226186
Message ID:
01226192
Vues:
16
class MyClass
{
  public MyClass(int age):this(age, true){}

  public MyClass(int age, bool alive)
  {
    // do stuff
  }
}
Hmmm I knew I should have known how to do that <s>

>Can I do something similar to this:
>
>class MyClass
>{
>  public MyClass(int age)
>  {
>    MyClass(age, true);
>  }
>
>  public MyClass(int age, bool alive)
>  {
>    // do stuff
>  }
>}
>
>
>This doesn't compile but I think my intentions are clear.
>I am having a hard time thinking clear any help would be appreciated.
>
>Thanks,
>Einar
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform