hei. the language is java.
i want to extend this class which the constructor has parameters.
this is the main class
public class CAnimatedSprite {
public CAnimatedSprite(String pFn, int pWidth, int pHeight) {
}
}
this is the child class
public class CMainCharacter extends CAnimatedSprite {
//public void CMainCharacter:CAnimatedSprite(String pFn, int pWidth, int pHeight) {
//}
}
how do i write the correct syntax?
and the error is “constructor cannot be applied to given types”
You can define any arguments you need for your constructor, but it is necessary to call one constructor of the super class as the first line of your own constructor. This can be done using
super()orsuper(arguments).