0
Hello, I’m new with object-oriented programming and programming in general too, but in an example like the following:
public class Profissao{
public void trabalhar(){
//trabalho...
}
}
public class Ferreiro extends Profissao{
public void consertarEspada(){
//conserta...
}
}
public class Programa{
public static void main(String args[]){
Profissao x = new Ferreiro;
}
}
I know the object is x, but is it the instance? If so, which class is it? Profession or Blacksmith?
And how can an object of the Profession type receive attributes or methods of the Blacksmith class in this case? If Blacksmith is a subclass of Profession.
Thanks in advance.
Also: What is the difference between a class and an object?
– Piovezan