由买买提看人间百态

topics

全部话题 - 话题: override
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
m******t
发帖数: 2416
1

why
it
Hmm I haven't had my daily coffee today, so correct me if I'm being
stupid. 8-)
You can have:
class Super { public f(){} }
class Sub extends Super { public final f() {} }
somewhere else you have:
Super super = new Super();
Super super1 = new Sub();
super.f();
super1.f();
I don't see how this can be decided at compile time.
I think it's possible to opitimize out the late binding *only if* the final
method does not override another one.
c*y
发帖数: 137
2
You are right. I forgot you can override a non-final method by a final one....
hehe.
m******t
发帖数: 2416
3

If a final method does not override any other method, a compiler
may choose to optimize all the calls to this method to be static binding.
A final method must be marked in the bytecode, otherwise a compiler would
not be able to prevent it from being overriden (e.g. when the enclosing
class is located in a jar file)
b**l
发帖数: 25
4
来自主题: Java版 - override/overload/overwrite in Java
override == overwrite
a**e
发帖数: 5794
5
来自主题: Java版 - override/overload/overwrite in Java
overriding是子类对父类method,overloading是同一个类中的method,
hiding是静态系统method

methods
J*****n
发帖数: 48
6
来自主题: Programming版 - pointer to override function?
I need to let function A be an argument for function B,
but function A has two forms (override), how can I
include the two types as a general form of A in argument of B?
for example
float A(int);
float A(int, double);
I want
float B((*A)(?),other arguments)
how do I substitute content denoted by "?"
n**d
发帖数: 9764
7
来自主题: Programming版 - overriding operator<<
So far I have seen to override operator<< by friend only, like this.
friend ostream&
operator<<(ostream& os, const Number& x) {...}
How to implement this as a member function, instead of friend? Possible?
n*******r
发帖数: 22
8
【 以下文字转载自 JobHunting 讨论区 】
发信人: newdriver (小小的光), 信区: JobHunting
标 题: 问一个C++问题:default parameter and overriding/inheritanc
发信站: BBS 未名空间站 (Tue Feb 22 01:33:31 2011, 美东)
class A
{
private:
int n;
public:
virtual void Fun1(int no=10)
{
n = no;
cout<<"A::Fun1"< }
};
class B : public A
{
private:
int m;
public:
virtual void Fun1(int no=20)
{
m = no;
cout<<"B::Fun1()"< }
}
int main()
{
B b;
A &a =b;
a.Fun1();
return 0;
}
这个程序的输出是 B::Func1()10
实在想不明白为什么输出... 阅读全帖
D*****I
发帖数: 8268
9
怎么override啊?那还是电控啊
T********e
发帖数: 8631
10
日本车都有deceleration fuel cut off,只要一抬脚就不给油了,没什么好override的
T********e
发帖数: 8631
11
Break override can fail too
R*******a
发帖数: 2463
12
其实break override 这个东西一般情况下根本没用,还会带来别的麻烦
T********e
发帖数: 8631
13
“问题是你抬脚了,它却没感觉到”算啥?
日本车都有DFCO所以根本不需要override, unless you insist on comparing failure, then you have to compare failure
N******p
发帖数: 2777
14
来自主题: _Auto_Fans版 - 想纯技术讨论Brake override system
我记得有不少手动GTI的车主说由于这个override,heel-toe时没法blip油门了。
w*******d
发帖数: 3714
15
来自主题: _Auto_Fans版 - 想纯技术讨论Brake override system
但是自动GTI反而没有override嘛?launch control就是同时踩油门刹车的嘛
N******p
发帖数: 2777
16
来自主题: _Auto_Fans版 - 想纯技术讨论Brake override system
这个override在车静止的时候是不起作用的。
F*********e
发帖数: 2696
17
来自主题: _Auto_Fans版 - 想纯技术讨论Brake override system
面板上做个开关
给你选择关闭override,默认状态是开启
就像可以选择关闭ESP一样
y*******n
发帖数: 10103
18
来自主题: _Auto_Fans版 - 想纯技术讨论Brake override system
我的G35 6mt是可以heel and toe的。应该没有override的功能。
y*******n
发帖数: 10103
19
来自主题: _Auto_Fans版 - 想纯技术讨论Brake override system
不知道德国手动车有没有override功能,明天问问开328i的同事。
y*******n
发帖数: 10103
20
来自主题: _Auto_Fans版 - 想纯技术讨论Brake override system
应该说是比较hard的了,入弯减速heel and toe 降档嘛。也许还有离合这个变量。如果踩了离合就
不要override。

well.
y*******n
发帖数: 10103
21
来自主题: _Auto_Fans版 - 想纯技术讨论Brake override system
今天试了一下,的确,没有踩离合的话,刹车会override油门。

如果踩了离合
m******1
发帖数: 19713
22
来自主题: _LGBT_News版 - R.I. Lawmakers Override Gov.'s Antigay Veto
By Advocate.com Editors
RHODE ISLAND SENATE DONALD CARCIERI x390 (fair use) | Advocate.com
On their first day back to work, Rhode Island’s house members — followed
by the state senate — voted to override Republican governor Donald Carcieri
’s veto of a series of bills, including one that would give domestic
partners the right to claim the bodies of and make funeral arrangements for
each other.
The house vote was 67 to 3, and the senate vote was 29 to 3.
Carcieri vetoed the bill last year, saying
w*****j
发帖数: 226
23
来自主题: JobHunting版 - 秒杀valid number
用自动机写的
求批判
个人觉得自动机的好处是可视化,只要图画对,代码不容易写错
corner case看得也比较清楚
enum State
{
ErrorState
{
@Override
public boolean isValid() { return false; }
},
EndState,
StartState
{
@Override
public State readDigit() { return DigitState; }
@Override
public State readPlus() { return PlusState; }

@Override
public State readMinus() { return MinusState; }

@Override
public State readPoin... 阅读全帖
w*****j
发帖数: 226
24
来自主题: JobHunting版 - 秒杀valid number
用自动机写的
求批判
个人觉得自动机的好处是可视化,只要图画对,代码不容易写错
corner case看得也比较清楚
enum State
{
ErrorState
{
@Override
public boolean isValid() { return false; }
},
EndState,
StartState
{
@Override
public State readDigit() { return DigitState; }
@Override
public State readPlus() { return PlusState; }

@Override
public State readMinus() { return MinusState; }

@Override
public State readPoin... 阅读全帖
m*****n
发帖数: 204
25

The following is an O(nlgn) solution for string of size n.
It maintains a heap for eligible chars, preferring longer streams.
Ineligible chars are maintained in a candidate queue, and added back
to the working queue when their position constraint is removed.
public class MinDistance {
public String rearrange(String source, int distance) {
// TODO Check params.

// WorkingQueue of eligible streams. Longest stream at head,
// but BackupStream at tail.
PriorityQueue阅读全帖
q****x
发帖数: 7404
26
来自主题: Programming版 - 几个C++书写风格疑问
都是关于书写风格的。
1. 有必要手动禁用default ctor吗?
class A {
public:
explicit A(int i) : data_(i) {}
private:
int data_;
};
class A {
public:
explicit A(int i) : data_(i) {}
A() = delete;
private:
int data_;
};
有人认为第一个写法就够了,编译器不会自动生成default ctor。有人认为第二个写法
好,直接告诉用户default ctor是要禁用的,以免用户不小心又添加了default ctor。
谁有道理?
2. 纯虚类的虚函数声明。
纯虚类里只要有一个函数为虚,则所有都为虚。但声明纯虚时可以有多个变种如下。哪
个规范?
第一个写法,把所有的虚函数都声明为纯虚。
class A {
public:
virtual ~A() = 0;
virtual void foo() = 0;
virtual void bar() = 0;
};
inline A::~A() = d... 阅读全帖
i****a
发帖数: 36252
27
来自主题: Automobile版 - 福特自动加速
http://www.usatoday.com/story/money/cars/2013/03/28/ford-class-
Lawsuit: Older Fords can suddenly speed up
A multistate lawsuit filed Thursday says 2002-10 Ford Motor vehicles contain
a "design defect" in the electronic control of the gas pedals, making them
susceptible to sudden, unintended acceleration.
The lawsuit filed on behalf of Ford owners in 14 states is seeking class-
action status and goes into great detail about the alleged defect in the
models named in the lawsuit that don't have br... 阅读全帖
a****g
发帖数: 3027
28
这么说系统设计绝对有问题: 不管怎么允许override,总不能允许override出来一个幽
灵车在前面吧?这是最后一道防线了, 只要有辆车在铁路上跑/停,后面几公里之类必
须是红灯信号。如果允许领导override这个防线,那么就是说授权领导/前车杀人的权
利。
从设计上来说,必须要到fail-safe的设计,即只有前车正确汇报位置时,才允许其一
定距离之后绿灯开放。其他情况必须是红灯。
系统设计允许领导override成绿灯,但必须要求多人输入正确的车子位置信息,之后计
算车子之后多远可以override成绿灯。涉及到人override,必须有多人确认,否则那个
领导被双归前这么搞一把,那么火车旧成为炸弹了.当然,如果多人都是一伙的,都输
入同样的错误地址搞破坏,那就只有任命了,神仙也防不了。
安全的系统必须处理:如果有捣乱的车,怎么处理捣乱的。最严格的是,只有严格遵循
协议的放行,否则按导乱处理。
副作用就是:由于通信问题,才开始虚惊的事情多点。但是这个可以通过多备份
数链路+人工确认来处理。
i****x
发帖数: 17565
29
来自主题: Automobile版 - 如果遇到toyota加速问题
才送走个胡搅蛮缠的,又来一个。
我说测试中各种车油门全开能刹住,你说因为其他品牌都有override brake所以才能刹
住,没有override的肯定刹不住,并且口出狂言说“不懂就别来害人”。
我给你重帖文章,指出好几辆没有override brake的车也都能刹住,你说没看到款型年
代,还说要安四个镜头一起拍才能证明能刹住,暗示杂志也是作假。其实原文明确说了
这几辆车是他们best of year的测试车款并且给出了链接,一点就能看到款型年代。
然后还说“自动加速问题在丰田车的电子油门的车型是事实存在,不容置疑”却不提供
任何证据。
这里我再贴一个视频
http://www.insideline.com/toyota/camry/2010/2010-toyota-camry-s
10款camry,四次测试,第一次正常刹车,第二次油门全开放空挡刹车,第三次油门全
开放D档刹车,第四次油门全开放D档并卸除刹车助力刹车。结果全都能刹住。这车肯定
没有override系统,因为第二次刹车中可以听到引擎一直在红区转速并未切断。
不我也知道你又要说这个杂志也被toyota买通了,必须得100... 阅读全帖
y*******5
发帖数: 887
30
来自主题: JobHunting版 - 求指点一道G家Iterator的题目
用composition pattern:
1:---
package NestedIterator;
public interface NestedNodeList extends Iterable {
}
2:---
package NestedIterator;
import java.util.Iterator;
public class Node implements NestedNodeList {
private E val;
public Node(E val) {
this.val = val;
}
@Override
public Iterator iterator() {
return new NodeIterator();
}
private class NodeIterator implements Iterator {
private boolean iterated = false;
@Override... 阅读全帖
b*g
发帖数: 644
31
9. Mistyping the name of a method when overriding
Overriding allows programmers to replace a method's implementation
with new code. Overriding is a handy feature, and most OO programmers
make heavy use of it. If you use the AWT 1.1 event handling model,
you'll often override listener implementations to provide custom
functionality. One easy trap to fall into with overriding, is to mistype
the method name. If you mistype the name, you're no longer overriding a
method - you're creating an entirely
H****S
发帖数: 1359
32
来自主题: Programming版 - 看来跳了Scala的坑是对的
monad 其实只需要unit 和 flatmap就够了
zip就是一个flatmap加map的showcase。其实用pattern match也可以。
sealed trait Option[+A] {
def map[B](f: A => B): Option[B]
def isEmpty: Boolean
def get: A
def flatMap[B](f: A => Option[B]) = if (isEmpty) None else f(this.get)
def zip[B](ob: Option[B]): Option[(A, B)] = this flatMap (a => ob map (b =
> (a, b)))
}
case object None extends Option[Nothing] {
override def map[B](f: A => B) = None
override def get: A = throw new Exception("cannot get none")
override def i... 阅读全帖
k*****e
发帖数: 22013
33
来自主题: QueerNews版 - 同性婚姻大讨论合集之一
☆─────────────────────────────────────☆
willhung (黄威廉) 于 (Mon Feb 1 15:24:47 2010, 美东) 提到:
发信人: aptget (apt), 信区: USANews
标 题: 同性婚姻受不到祝福也成了叽歪的理由了?
发信站: BBS 未名空间站 (Mon Feb 1 13:38:17 2010, 美东)
不受祝福的婚姻多了,suck it up!
至于同性和乱伦的关系,人家说的根本不是法律能不能修改成允许前者禁止后者。人家
说的是,反对限制同性婚姻的微薄理由同样适用于反对限制包括乱伦在内的许多异类“
婚姻”,这是法律范畴的问题,是个很严肃的问题,直接关系到这个问题应该用粗暴的
法律手段来解决,还是让社会自己去解决。
至今为止,未见哪怕一个自私的gay和其好心但********的支持者们说出为什么同性婚
姻不能限制,但乱伦能够限制。
==注:经过作者授权,版主将原贴的不雅词汇修改.
☆─────────────────────────────────────☆
majia111 (maji... 阅读全帖
d*b
发帖数: 21830
34
这个完全不是你想象的那样,设想一下,要刹车可以override油门,我idle的时候能
override?我低速的时候能override?
刹车override油门是指你左脚踩刹车,右脚又“同时”踩了油门的时候,刹车override
油门的输入信号,而不是车高速行驶的时候踩刹车可以切断油门。
m*******q
发帖数: 139
35
来自主题: ebiz版 - 现在的小护士
说的这么动听自己去扫好了,别忽悠小护士了
姑且以K145为例说说
1. 店里系统价格并不是99.99而是129.99,需要经理来override,override已经不爽了
,碰上mean的直接不给,碰上自作聪明的拿广告告诉你99.99是rebate以后的价格.碰上
还算好的,check一天SKU,核对了去给你override
2.override完还站在旁边你又让他扫25%coupon,她会爽?
3.就算又勉强扫了,你还敢买第二个?
4. 即使override了,coupon也扫了,价格是75.99+tax,对大部分州来说随便上80了,
然后倒贴卖80甚至低于80,等着一个月后那种有一定风险的所谓reward和一个20刀不知
道是否寄丢的staples gc?
5.staples现在关了这么多店,一天扫8个店的地方不多了吧?
6.rebate limit 5 per address,给你10个机器往哪里做rebate?
m*****n
发帖数: 204
36
来自主题: JobHunting版 - Java编程讨论:LinkedIn的H2O

public class ElementsImpl implements IElements {

private final int batchSize;
private final AtomicInteger counter = new AtomicInteger();

ElementsImpl(int i) {
batchSize = i;
}

public int getBatchSize() {
return batchSize;
}
@Override
public void inc() {
counter.incrementAndGet();
}
@Override
public boolean reserve() {
int val = co... 阅读全帖
m*****n
发帖数: 204
37
来自主题: JobHunting版 - Java编程讨论:LinkedIn的H2O

public class ElementsImpl implements IElements {

private final int batchSize;
private final AtomicInteger counter = new AtomicInteger();

ElementsImpl(int i) {
batchSize = i;
}

public int getBatchSize() {
return batchSize;
}
@Override
public void inc() {
counter.incrementAndGet();
}
@Override
public boolean reserve() {
int val = co... 阅读全帖
S**********C
发帖数: 161
38
来自主题: Java版 - 问个Object.hashCode()的问题
书上说,一般Override equals()的时候要同时Override hashCode()
那么,如果我
1)不Override hashCode()
2)Override hashCode(),但返回一个常数,比如10
3)Override hashCode(),但随机产生一个数,而不是根据
一般的根据Object里面的Fields(e.g Employee(employeeId,name)来定
以上三种情况,后果分别是什么?Java是如何判断两个
Object是否"相等",只要equals() return true,还是同时要
hashCode()返回相同的值?
g*********r
发帖数: 9366
39
来自主题: ChinaNews版 - 中国新闻版暂定版规
版规分两部分, 前面为一般原则, 附录中为各种细则,您开始通读一般原则即可,等有用时再查细则不晚。
一般原则
在中国新闻版请尽量讨论与中国的政治、经济、社会,军事, 文化、外交,新闻 等有
关话题。 欢迎新闻时政贴以及热点讨论。
本版反对违反美国法律的讨论, 任何网友发帖引起的法律纠纷以及私人恩怨, 版
务不予负责;本届版务也不会配合站规之外的违反美国法律以及/或者言论自由原则的
任何额外要求,如果版务无法抗拒,将公开辞职。
本版没有特定立场,版务须维护本版的言论自由,坚持公平平等理性原则, 维护
各路将军们的发言权利,鼓励大家创作和发言热情,促使大家畅所欲言不得无故删除时
下网友的帖子,不得无辜封禁;
版主版副不得因个人的观点立场封禁,删贴。 版务可以参与讨论,但不做观点裁判。
PA 和言语极度粗俗将被删帖或封禁。
有价值帖子将分门别类整理,并将收录于精华区中, 版务将不分政治态度执行。
一、 版面整理和封禁制度
版务正常删水:会尽量从旧帖开始清理,有价值帖子将直接或合集收精华区,但是不保
证我们的“有价值帖子” 标准和诸位将军的标准一致,因此诸位认为自己有价值的帖
子,希望能... 阅读全帖
y*h
发帖数: 25423
40
来自主题: Military版 - 法航447 A330

信号上可以override当然没问题,但是游戏杆的那种对人没有感觉,非机械联动,所以
override的时候需要进行人工开关切换,然后才管用,切换时需要语言沟通,要是忘了
切换或者不看切换指示灯或者指示灯坏了就会出现一个驾驶员认为自己在控制飞机,其
实控制权是在另一个人那里。
机械联动的是同步的,一个人动方向盘另一个能感觉到在动,动多大,多少力气,想
override就用力扳就是了,谁的力气大谁说了算。。。这种override不需要切换,也不
需要指示灯,甚至不需要语言沟通。
R****a
发帖数: 6858
41
来自主题: Military版 - 大棋局与9/11
大棋局与9/11
来源: ognc 于 2013-02-22 16:08:44[档案] [博客] [旧帖] [转至博客] [给我悄悄
话] 本文已被阅读:63次
字体:调大/调小/重置 | 加入书签| 打印| 所有跟帖 | 加跟贴| 查看当前最热讨论主题
The Moral Decoding of 9-11
By Prof. John McMurtry
(Journal of 9/11 Studies) - I was sceptical of the 9-11 event from the first
time I saw it on television. It was on every major network within minutes.
All the guilty parties were declared before any evidence was shown. The
first questions of any criminal investigation were erased. Who had the most
compelling motives for... 阅读全帖
m******1
发帖数: 19713
42
A new Quinnipiac poll reveals that a majority of New Jersey voters continue
to support same-sex marriage and want a referendum on the issue.
BY Julie Bolcer
May 17 2012 10:55 AM ET
6
According to the poll, voters in the Garden State back same-sex marriage by
53% to 42%, which is on par with findings from the winter. However, voters
across all age groups also want a referendum on the issue, a finding also in
line with polls earlier this year.
Among those who support same-sex marriage, support is ... 阅读全帖
l****z
发帖数: 29846
43
Today Illinois Enters the 21st Century: Last State in USA to Have Concealed
Carry Laws »
by Jammie
Of course not without a fight. The raving anti-gun nut in the governor’s
mansion is fighting tooth and nail in opposition but the court order will
take effect today, and even Democrats are vetoing his weak last minute
amendment. So, law-abiding citizens of Illinois, today you catch up with the
rest of America. You know, it’s almost as if these hacks in Illinois don’
t believe in the Second Ame... 阅读全帖
l********y
发帖数: 543
44
你加入人控制了恐怖分子不一样override了。最多加一个允许警察override。然后又有
新问题,为啥黑人少override,白人多呢?警察种族歧视。


: 谁告诉你这个自动强制刹车要取代人踩刹车的?

: 哥的文章里只字没提这个吧? 你别加入你的狂想啊

: 正常什么时候刹车都是人自己控制, 只有在特定的情况下(也就是空袭场景比
如AI可

: 以设定为已经压死一个人继续压第二个人的时候), 系统才override.

: ,

I***i
发帖数: 14557
45
来自主题: Automobile版 - Toyota Not Liable in Camry Driver's Death
http://blogs.cars.com/kickingtires/2013/10/jury-finds-toyota-no
After a string of federal penalties and settlements topping $1 billion, all
pertaining to Toyota's unintended-acceleration recalls, the automaker scored
a victory this week in Superior Court in Los Angeles. A jury ruled that
Toyota was not liable for the death of a California woman killed in a 2009
car crash.
The suit had claimed that Noriko Uno died because her 2006 Toyota Camry
lacked a brake override system when she was struck by... 阅读全帖
f****t
发帖数: 15913
46
刹车是爷--zt:你还会买丰田车吗?(摘自美国中文网)(转载)点击:297 回复:9 作
者:玩美兔圈 发表日期:2010-3-2 16:32:00
日本车一直以来就是省油,轻巧的代名词。很多美国人放弃自产的福特而青睐于日本车
。但2010年的丰田召回风波却在美国愈演愈烈。丰田总裁亲自来美解释似乎都无计可施。
这件事情后, 你如果要买车还会选择日本的丰田吗?
日本车:即使不是丰田也有安全隐患!
(一)丰田油门踏板的问题到底是怎么回事
丰田(Toyota )因为突然加速并刹不住车而引发的“丰田安全危机”风暴席卷全球,
目前我们知道丰田已经开始维修,就是在油门踏板上加一个铁片!我让大家知道丰田加
一个铁片的道理,也能明白丰田是靠改装这个玩意忽悠它的消费者,还是真的能解决问
题。
那么,为何丰田不把召回的车统统换成 Denso 的油门踏板呢?有人抱怨说如果换成新
的油门踏板,丰田要出更多的血,买踏板要比买铁片贵多了。这是所谓的“内行”们非
常恼火丰田的地方。然而,润涛阎告诉您:这两种油门踏板给出的信号可能是不一样的
。 CTS 出的那个踏板是金属的,测出的是 A 与 B 之间的接触面积(踩油... 阅读全帖
G******i
发帖数: 5226
47
来自主题: JobHunting版 - [合集] H1-H4-H1身份问题
☆─────────────────────────────────────☆
nimble (nimble) 于 (Thu Oct 28 14:19:30 2010, 美东) 提到:
前一阵子被雷, 就递上了h4的申请,结果等了几个月都还没有批下来。 最近找到了新
工作,也递了h1的申请,马上就批下来了。
请问一下,现在需要去把这个还在pending的h4 withdraw么?
不撤回的话担心会overwrite 这个h1的申请,
撤回的话过去几个月的身份是不是就有问题了?
希望过来人能指点一下,有包子答谢
☆─────────────────────────────────────☆
Ginobili (潘帕斯雄鹰) 于 (Thu Oct 28 15:47:33 2010, 美东) 提到:
是否应该withdraw H4
要看你新旧H1B之间是不是有GAP
一般情况是有的
所以你要做的不是withdraw H4
而是call USCIS
告诉他们你的新H1B已经批准了
而你的H4还在pending
USCIS需要尽快批准你的H4申请
而且要确保你的H4生效期早于... 阅读全帖
F*****e
发帖数: 331
48
来自主题: JobHunting版 - 一道design pattern的问题
问题是关于decorate pattern(装饰模式),就是给一个人一件一件穿衣服的程序,基
类是人,第一个子继承类是Finery(服饰),Finery下面有3个子继承类分别是:
Tshirt Sneaker Trousers。 程序中用到了装饰模式的思想,和一堆虚函数和覆写函数
,关于这些函数和覆写函数是怎么跑的我看不明白,贴上代码:请牛人观观!
class Program
{
static void Main(string[] args)
{
Person Alice = new Person("Alice");
Console.WriteLine("\n Alice's beautiful dress are:");
Sneakers sneaker = new Sneakers();
BigTrouser trouser = new BigTrouser();
TShirts tshirt = new TShirts()... 阅读全帖
X*K
发帖数: 87
49
来自主题: JobHunting版 - 讨论一个题目
靠,想来不难,但是很容易出错啊。这个算是验证过了。
public class NextPower implements Powers {
List powerList;
long previous;
public NextPower() {
powerList = new ArrayList();
reset();
}
@Override
public Long next() {
long min = Long.MAX_VALUE;
List minList = new ArrayList();
for (int i = 0; i < powerList.size(); ++i) {
int base = i + 2;
int power = powerList.get(i) + 1;
long n = (long) ... 阅读全帖
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)