eclipse - Easiest way to call one same method in two different class junit -
i have got 1 method login
in "first class"
. in "second class"
again login needed done, can tell me what's easiest way task ?
- should create object of first class in second class , call methods of first class.
- should create base class , extend ?
please provide example if possible thanks
alright let me answer here:
class mybase { void login() { // todo base defined login here } } class firstclass extends mybase { // define methods in order fine void login() { // todo firstclass defined login here } void addtest() { // addtest code here } } int main() { mybase base; firstclass firstclass; base.login() // call mybase method login firstclass.login() // call firstclass method login }
so order of defining methods isn't important long doing them nicely. if possible read inheritance in java more clear approach.
do understand now..? if yes start coding , if not let me know , we'll go more deeper...
Comments
Post a Comment