由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 问一个特别土的问题
相关主题
can applet implements runnable?How to represent n:n relationship in Java?
interface和implementation class问一个版权的问题 (转载)
How does a client find and connect to a specificanother Java interview Question
Re: Can create a Interface object, why?a question on interface
[转载] help please on Java一个event model的概念级的问题
问题征解comparable interface in generic container
这个方法到底如何调用的?Windows 下 Java console application 的问题
JAVA DOC 的问题Why java.lang.Iterable depends on java.util.Iterator
相关话题的讨论汇总
话题: interface话题: 懒儿话题: 偷点话题: overload
进入Java版参与讨论
1 (共1页)
r*******w
发帖数: 121
1
一个class,实现了很多的功能
现在想换一个implementation(原来的implementation同时也要用)
是不是应该提取一个interface出来
然后两个不同的implementation时parallel的关系呢?
还是偷点懒儿,就让新的implementation继承前一个但是所有的function都overload呢?
s*******s
发帖数: 3
2
interface. it's not much of work

【在 r*******w 的大作中提到】
: 一个class,实现了很多的功能
: 现在想换一个implementation(原来的implementation同时也要用)
: 是不是应该提取一个interface出来
: 然后两个不同的implementation时parallel的关系呢?
: 还是偷点懒儿,就让新的implementation继承前一个但是所有的function都overload呢?

r*******w
发帖数: 121
3
how do you do static method in an interface/

还是偷点懒儿,就让新的implementation继承前一个但是所有的function都overload呢?

【在 s*******s 的大作中提到】
: interface. it's not much of work
r*******w
发帖数: 121
4
cannot do static method in an interface...
ft to death...
now have to modify many many things~~



【在 r*******w 的大作中提到】
: how do you do static method in an interface/
:
: 还是偷点懒儿,就让新的implementation继承前一个但是所有的function都overload呢?

n*****k
发帖数: 123
5

May be you could use interface --> abstract class?
还是偷点懒儿,就让新的implementation继承前一个但是所有的function都overload呢

【在 r*******w 的大作中提到】
: cannot do static method in an interface...
: ft to death...
: now have to modify many many things~~
:
: ?

F****n
发帖数: 3271
6
You still cannont inheritate static method in subclasses, so there is no
differences.
The only thing different is using interface you need to modify both your
original class and your new class, using inheritance you only need to take
care of the new one. But if you use interface, you can easily expand your code
in the future, say, if you want a third or fourth implementations.

还是偷点懒儿,就让新的implementation继承前一个但是所有的function都overload呢

【在 r*******w 的大作中提到】
: cannot do static method in an interface...
: ft to death...
: now have to modify many many things~~
:
: ?

r*******w
发帖数: 121
7
this is a good suggestion!
indeed i have used abstract classes in other places...
but i have already changed everything to be based on interface...
and move all the static methods to a factory class...
maybe next time ba~~~

【在 n*****k 的大作中提到】
:
: May be you could use interface --> abstract class?
: 还是偷点懒儿,就让新的implementation继承前一个但是所有的function都overload呢

1 (共1页)
进入Java版参与讨论
相关主题
Why java.lang.Iterable depends on java.util.Iterator[转载] help please on Java
Is this a Bug or not?问题征解
Help.?How to implement Math function?这个方法到底如何调用的?
Timer and TimerTaskJAVA DOC 的问题
can applet implements runnable?How to represent n:n relationship in Java?
interface和implementation class问一个版权的问题 (转载)
How does a client find and connect to a specificanother Java interview Question
Re: Can create a Interface object, why?a question on interface
相关话题的讨论汇总
话题: interface话题: 懒儿话题: 偷点话题: overload