vendredi 8 juillet 2016

Pass a class name to a function having different type

I have a function which will return class name.

public Class<?> fun(String ClassName)

{

     //
     return ABC.Class;
}

In my class i have to call a function sale

public Class XYZ

{

    public Object Solve()

    {

       //

       sale(fun("ABC"));

    }

}

Sale function definition:

public int Sale(Class &lt;T&gt; clazz)

{

}

As function Sale has Arguments of type Class<T> but i am passing parameter of type Class<?> . I don't know how will it work.





Aucun commentaire:

Enregistrer un commentaire