uOttawaUniversity of Ottawa - Canadas University
list of dots

Umple User Manual    [Previous]   [Next]   

Loading

E220 Two Methods With the Same Name

Umple semantic error related to changing name of a provided method in traits to one which already exists

When changing the name of provided methods in traits, it is necessary to be sure that there are no other methods with the same names that come from other traits. If the changed name already exists inside of a class, in this case there is no problem becase methods of classes have priority over ones coming from traits. In this case, the method from traits will be disregarded. Otherwise, there is a conflict on the name of methods. The Umple compiler detects this case and raises the error

Example

// In this example, there is an error because in class "A" there will be two methods with the name "ShowInConsole".
class A{
	isA T;
}
trait T{
	isA T1;
	void show(){/*T*/}
}
trait T1{
	void ShowInConsole(){/*T1*/}
}

      

Load the above code into UmpleOnline

 

Another Example

// In this example, there is an error because in class "A" there will be two methods with the name "ShowInConsole".
class A{
	isA T;
	isA T1;
}
trait T{
	void show(){/*T*/}
}
trait T1{
	void ShowInConsole(){/*T1*/}
}

      

Load the above code into UmpleOnline

 

Another Example

// In this example, there is an error because in class "A" method "ShowInConslole" has high priority.
class A{
	isA T;
	isA T1;
	void ShowInConsole(){
	//Implementation 
	}  
}
trait T{
	void show(){
	//Implementation
	}
}
trait T1{
	void ShowInScreen(){
	//Implementation
	}
}

      

Load the above code into UmpleOnline