Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Decrement operator
Message
De
03/09/2008 06:35:52
 
 
À
03/09/2008 05:30:43
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01344042
Message ID:
01344415
Vues:
14
>works but requires odd syntax: int i = (NonZeroInstance++).I

Viv,

Come to think of it. Implementing a type with operators takes some work

To implement
- ToString()
- Equals()
- GetHashCode()
- the casts (also an operator)
  - implicit casts (where there is no loss of precision)
  - explicit casts  ( with possible loss of precision)

- Operators - comparaison
==
!=
<
<=
>
>=

- Operators - arithmetic
++
--
+
-
/
*
Back in May, I have - as an excercise - written a Fraction class (as a structure: Nominator, denominator) with constructors a la var xx = new Fraction("1/11")

It took a lot of time, but I have also learned a lot
Should you be interested - I'll be happy to mail it
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform