Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: sargasso on March 17, 2004, 03:30:18 pm

Title: Configure and Override Attribute Initialisers
Post by: sargasso on March 17, 2004, 03:30:18 pm
What does this context menu item do?

I can see it annotates the initial value of an attribute in the diagram, but it doesn't do anything in termns of code generation.  Or am I expecting something that doesn't exist?

Suppose we have two classes "abstractFish" and "RainbowTrout:abstractFish".  abstractFish has an property attribute "CommonName" with an intial value of "Fishy".  RainbowTrout specialises abstractFish, inheriting all operations and properties, but we want to override the "CommonName" property initialiser to "Rainbow Trout".  
(http://www.users.bigpond.com/bbruen/fish.png)
The code generator produces:
Quote
public abstract class abstractFish {
      private string Genus = "Fishy";
      private string Species = "Fishy";
      private string CommonName = "Fishy";

      public abstractFish(){
      }
...etc

and
Quote
public class RainbowTrout : abstractFish {
      public RainbowTrout(){

      }
      public static override string CommonName {
            get{
                  return CommonName;
            }
            set{
                  CommonName = value;
            }
      }
}//end RainbowTrout


So, what is the "Configure and Override Attribute Initialisers" for, if not to generate code?

Bruce

p.s. Guess what I'd rather be doing.