Reputation: 5008
I have a class that extends Activity like so:
public abstract class AndroidGame extends Activity implements Game
This class has an onCreate() method like this:
public void onCreate(Bundle savedInstanceState) {
// I do stuff here
}
Then I make another class that extends AndroidGame like so:
public class ScatmanNomGame extends AndroidGame {
// The loading screen will load all the assets of our game
@Override
public Screen getStartScreen() {
return new LoadingScreen(this);
}
}
Ok, so here is my question. My default start activity (in my manifest file) is set to load ScatmanNomGame first. Upon launch of my program, the Launcher activity is ScatmanNomGame. But notice that ScatmanNomGame has no onCreate()
method. Will simply starting this activity (ScatmanNomGame) call it's super class's onCreate
method?
Upvotes: 0
Views: 861
Reputation: 29199
Yes, It would, Read Inheritence.
Inheritence allows object of subclass to use/access public and protected fields and methods.
So, If you havent overrided any method in the subclass, and invoking the same method on the object of subclass will invoke method of superclass.
Upvotes: 1