|
E040 Singleton Has Subclasses
[Previous]  [Next] 
|
![]() |
User Manual [Previous]  [Next] E040 Singleton Has SubclassesUmple semantic error generated when a singleton class has subclassesSingleton 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 Solution to The Above So the Message No Longer Appears
//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 |