Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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);				               
			}
		
		}
    }
	
}



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.
Posted
Updated 31-May-18 6:30am
v2
Comments
Thomas.D Williams 30-May-18 17:12pm    
That's pretty hard to read when it's not English, but...
I think you may want:
if(!zeka.korunuyorMuRakipTaslarTarafindan(this.Rengi ,komsuLokasyon ,tahta))

You may need to use "super.Rengi" I haven't used Java for over 3 years.
Richard MacCutchan 31-May-18 3:58am    
I cannot see why the compiler thinks that the this pointer is of type Renk. There must be something in the code that you are not showing us.

1 solution

When I close and open the Eclipse, the error has gone. Thank you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900