Hello Im following the instructions in bulletpoints above fo
Hello, I\'m following the instructions in bulletpoints above for Exercise 6.2, based on the four lines of Java code below, do you see any errors?
Vampire enemy5 = new Vampire();
enemy5.set_xlocat(113);
enemy5.set_attackmode(7);
int test = enemy5.get_xlocat();
Solution
Hi, friend your code is correct:
// bullet 1
Vampire enemy5 = new Vampire();
// bullet 2
enemy5.set_xlocat(113);
// bullet 3
enemy5.set_attackmode(7);
// bullet 4
int test = enemy5.get_xlocat();
Since Vampire class is child class of Enemy class, so all public members of Enemy is also member of Vampire class
