Free cookie consent management tool by TermsFeed Policy Generator

Changes between Initial Version and Version 1 of Documentation/DevelopmentCenter/DeveloperGuidelinesSourceExample


Ignore:
Timestamp:
09/30/08 01:46:18 (16 years ago)
Author:
swagner
Comment:

created separate wiki page for source code example of CodingConventions

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/DevelopmentCenter/DeveloperGuidelinesSourceExample

    v1 v1  
     1= Source Code Example =
     2
     3{{{
     4#!cpp
     5/* A multiline comment
     6 * describing something ...
     7 */
     8using System;
     9using System.Collections.Generic;
     10using System.Text;
     11
     12namespace 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}}}