diff --git a/Qwirkle/Qwirkle/cm3.cs b/Qwirkle/Qwirkle/cm3.cs new file mode 100644 index 0000000..740031c --- /dev/null +++ b/Qwirkle/Qwirkle/cm3.cs @@ -0,0 +1,92 @@ +// LE FICHIER VOUS CHIE À LA GUEULE ET NE PEUT PAS ETRE COMPILÉ : C'EST NORMAL !! + +// types primitifs : int, double, short, ... +// types .NET : timespan, math, datetime, random, ... +// creation de 5 types difféents : classes(heap), structure(stack), interfaces(heap), delegate(heap), enum(stack) + +// ClassLibrary (classic one) (can't be executed without a project) + +namespace MyNamespace +{ + + public enum Jeremy // Flemme de le faire mais en gros on peut faire des combinaisons avec et c'est pété + { + chiant, + tresChiant, + vraimentTresChiant + } + + public class Class1 + { + private int nbPoil; // if not define, takes a default value (0 for int, ...) + + public Class1(string nom, int nbPoil) + { + this.Nom = nom; + this.NbPoils = nbPoil; + } + + /*public string GetNom() + { + if (name == null) + { + return "Unknown"; + } + return name; + } + + public void SetNom(string newname) + { + if (name == newname) + { + return; + } + + name = newname; + }*/ + + public string Nom // Méthode plus lisible que de faire les getters et setters à part + { + get + { + if (name == null) + { + return "Unknown"; + } + + return name; + } + + set + { + if (name == value) + { + return; + } + + name = value; + } + } + private string name; + + public int NbPoils // Méthode un peu barbare mais vas-y on gagne de la place + { + get; + set; + } + } +} + +// Console app (example) + +using MyNamespace; + +Class1 obj1 = new Class1("Chewy", 987654321); +Class1 obj2 = new Class1("Yoda", 256); + +Class1[] objects = new Class1[4]; // Tableau + +Class1[,] matrixObjects = new Class1[2, 4]; + +obj2.Nom = "Maitre Yoda"; +string leNom = obj2.Nom; \ No newline at end of file