“类型y中的方法x不适用于参数z”。错误 [英] "The method x in the type y is not applicable for the arguments z" error

查看:109
本文介绍了“类型y中的方法x不适用于参数z”。错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好;

我有一个让我发疯的问题。我抽象国际象棋。



以下是篇幅:

Hi There;
I have a problem that drives me mad. I am abstracting a chess.

Here is the piece:

public abstract class Tas {
    
    public int Anahtar;
    
    public Renk Rengi;   
 
    public int Degeri;
    
    public Tas()
    {
    	this.Anahtar = Integer.MIN_VALUE;
        this.Rengi = Renk.TANIMSIZ;
        this.Degeri = Integer.MIN_VALUE;

    }
}





这是国际象棋游戏规则:





Here is the chess play rules:

public class SatrancYapayZeka 
{
	//other details omitted for brevity

	public boolean korunuyorMuRakipTaslarTarafindan(Tas hamleYapanTas,Lokasyon olasiLokasyon ,Tas[][] satranctahtasi)
    {
		//other details omitted for brevity

    }
	
}







以下是从主件派生的主教课程:








Here is the bishop class that derived from pieces:


public class Fil extends Tas 
{

   @Override
    public ArrayList<Lokasyon> GetirKoruduguKareleri(Lokasyon lokasyonaGore,Tas[][] tahta)
    {
	
		SatrancYapayZeka zeka = new SatrancYapayZeka();
	
		//all possible moves in the down positive diagonal
		for (int yenix = xMevcut + 1, yeniy = yMevcut + 1; yenix < 8 && yeniy < 8; yenix++, yeniy++) {
		        
                        //error point 1
			if(!zeka.korunuyorMuRakipTaslarTarafindan(this,komsuLokasyon ,tahta))
			{			    		
				lokasyonListe.add(komsuLokasyon);				               
			}
		
		}
    }
	
}







我得到了



SatrancYapayZeka类型的方法korunuyorMuRakipTaslarTarafindan(Tas,Lokasyon,Tas [] [])不适用于争论(Renk,Lokasyon,Tas [] [])



在错误点1,我要求这个然而,它假定Renk枚举那个在片内定义。我缺少什么?



提前致谢。



我的尝试:



我看过stackoverflow但是那里描述的解决方案不适合我。




I am getting

The method korunuyorMuRakipTaslarTarafindan(Tas, Lokasyon, Tas[][]) in the type SatrancYapayZeka is not applicable for the arguments (Renk, Lokasyon, Tas[][])

at the error point 1, I demand "this" however, it presumes for "Renk" enum that defined inside Piece. What I am missing?

Thanks in advance.

What I have tried:

I have looked at the stackoverflow but the solutions described there is not suitable for me.

推荐答案

当我关闭并打开Eclipse时,错误已经消失。谢谢。
When I close and open the Eclipse, the error has gone. Thank you.


这篇关于“类型y中的方法x不适用于参数z”。错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆