| 1 | = Source Code Example = |
| 2 | |
| 3 | {{{ |
| 4 | #!cpp |
| 5 | /* A multiline comment |
| 6 | * describing something ... |
| 7 | */ |
| 8 | using System; |
| 9 | using System.Collections.Generic; |
| 10 | using System.Text; |
| 11 | |
| 12 | namespace HeuristicLab.Core { |
| 13 | public class Sheep : Mammal, IAnimal { |
| 14 | private double myWeight; |
| 15 | public double Weight { // a comment |
| 16 | get { return myWeight; } |
| 17 | set { |
| 18 | if (value > 0) |
| 19 | myWeight = value; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | |
| 24 | public Sheep() { |
| 25 | myWeight = 666; |
| 26 | } |
| 27 | public Sheep(double weight) { |
| 28 | myWeight = weight; |
| 29 | } |
| 30 | |
| 31 | |
| 32 | // a comment describing a method |
| 33 | public string LookABitSilly() { |
| 34 | return "Oo"; |
| 35 | } |
| 36 | |
| 37 | public override string ToString() { |
| 38 | return "Sheep (" + Weight.ToString() + " tons)"; |
| 39 | } |
| 40 | |
| 41 | public event EventHandler Baa; |
| 42 | protected virtual void OnBaa() { |
| 43 | if (Baa != null) |
| 44 | Baa(this, new EventArgs()); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | }}} |