-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompteBancaire
51 lines (47 loc) · 1.33 KB
/
CompteBancaire
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
type compte struct {
numcompte, soldeinit int
nomBanque, adresseB char[50]
rib, codebanque, solde int
nom, prenom,adresse, tel String
initialisation func()
}
getsolde func( c compte) int
{
return compte { c.solde}
}
debiter func(c compte, montant int)
{
if compte{c.solde} . = montant
{
compte{c.solde} := compte {c.solde} - montant
}else{
fmt.printf('opération impossible - solde insuffisant')
}
}
crediter func ( c compte , montant int )
{
if ( montant sup 0 )
{
compte { c.solde} := compte { c.solde} + montant
}
}
type compteEpargne Struct {
cpte Compte
taux interet uint64
initialisation func() ( bool, error)
gettauxinteret func() (uint 64, error)
settauxintert func () ( taux uint64)
}
initialisation ( ce CompteEpargne ) func ( p byte, e error, ok bool )
{
exported var e compteEpargne = new (compteEpargne );
ce1 := make (compteEpargne)
CompteEpargne{ce1.cpte} := " Compte de monsieur toto"
CompteEpargne{ce1.tauxinteret} = 18
if e!= nil
{
return 1, os.EINVAL, True
}else{
return -1, os.EINVAL, False
}
}