uOttawaUniversity of Ottawa - Canadas University
list of dots

Umple User Manual    [Previous]   [Next]   

Loading

E040 Singleton Has Subclasses

Umple semantic error generated when a singleton class has subclasses

Singleton is a software pattern to allow only one instance of a class. A singleton class has a private constructor and cannot be inherited.

Example


// In this example a singleton class has subclasses and it generates an error
class Airplane
{
  singleton;
}
class F16
{
	isA Airplane;
}
      

Load the above code into UmpleOnline

 

Another Example


//I this example the singleton class does not have a subclass and is correct
class Airplane
{
  
}
class TheAirplane
{
  singleton;
}
class F16
{
	isA Airplane;
}
      

Load the above code into UmpleOnline