android - Define an attribute that extends a class in java -
i have following class:
class foo { public void sayhello(){ system.out.println("hello"); } }
and want class hold reference class extends foo (but can't foo). (erroneous syntax):
class bar { private <e extends foo> e mfoo; }
is possible? how can without declaring in class name this?
class bar <e extends foo> { private e mfoo; }
if can make foo abstract class might solve if main point e can't instance of foo. if foo isn't abstract still do
public abstract class abstractfoo extends foo { }
and declare e of type abstractfoo.
Comments
Post a Comment