lundi 3 avril 2017

Does programming to an interface include extended classes

I have following class

public class RegisterUserDetails extends DatabaseCall {
public String setAddUserQuery(User user){
  //code

  return query;
 }
}

And here is the DatabaseCall class

public class DatabaseCall {
public ResultSet executeQuery(String query){
//code
return rs;
}

}

I was trying to program to a supertype/interface by doing this

DatabaseCall dbCall = new RegisterUserDetails();

However I cannot view the setAddUserQuery method this way. Why is this? It seems programming to an interface is only applicable for abstract classes and interfaces?

Aucun commentaire:

Enregistrer un commentaire