Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Following problem

  Asked By: Norma    Date: Mar 10    Category: Java    Views: 429
  

I have Follwing problem
There can be more classes like A & B in module.
i want that in the class D whenever i will call Method m2 of C passing string as
a NAME of calss it shd invoke the method m1 of respected class.
If still u r not clear just read the code once ..


class A{
public m1(){
}
}

class B{
public m1(){
}
}


class C{
public m2(String strName){

}
}

Class D{
C c_obj = new C();
c_obj.m2("A");//this shd invoke method m1 of class A
c_obj.m2("B");//this shd invoke method m1 of class B

}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Following problem Or get search suggestion and latest updates.




Tagged: