由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 又被铐倒了,关于constructor
相关主题
请教几个C++问题what is the difference?
Synthesized Constructor到底什么意思?问个构造函数的问题
[合集] 又学了一招菜鸟请教smart pointer
请教个Bloomberg 的 C++ 题目how to create interface "operator=="
Is the order of initialization a, b, c or c, b, a?non-aggregate type问题
一个c++ constructor的问题, thankshow to reverse a HUGE list?
question about Design Patternsswap every second node?
c++ question弱问一个
相关话题的讨论汇总
话题: 关于话题: return话题: false话题: 找出
进入Programming版参与讨论
1 (共1页)
h**o
发帖数: 548
1
问如果实现一个constructor时发生错误,(例如没new上)
如何找出错误。怎么答?
还问如何最有效找出一个数是否2的power.
我想了半天说x&(x-1)。对吗?以前没见过这题。
请问哪里能找到题库把面试题一网打尽那?太多了。
b*********n
发帖数: 1258
2
bool 2power(int x){
if (x){
if(!(x&(x-1))){
return true;
}else{
return false;
}
}else{
return false;
}
}

【在 h**o 的大作中提到】
: 问如果实现一个constructor时发生错误,(例如没new上)
: 如何找出错误。怎么答?
: 还问如何最有效找出一个数是否2的power.
: 我想了半天说x&(x-1)。对吗?以前没见过这题。
: 请问哪里能找到题库把面试题一网打尽那?太多了。

X****r
发帖数: 3557
3

if (x > 0) {

【在 b*********n 的大作中提到】
: bool 2power(int x){
: if (x){
: if(!(x&(x-1))){
: return true;
: }else{
: return false;
: }
: }else{
: return false;
: }

h**o
发帖数: 548
4
多谢帮助,这个班真好
有指导第一题的吗?

【在 h**o 的大作中提到】
: 问如果实现一个constructor时发生错误,(例如没new上)
: 如何找出错误。怎么答?
: 还问如何最有效找出一个数是否2的power.
: 我想了半天说x&(x-1)。对吗?以前没见过这题。
: 请问哪里能找到题库把面试题一网打尽那?太多了。

X****r
发帖数: 3557
5
不知道在问什么啊。

【在 h**o 的大作中提到】
: 多谢帮助,这个班真好
: 有指导第一题的吗?

M******k
发帖数: 27573
6
try catch? check if the instance is valid?
d*******d
发帖数: 2050
7
en,我也是不知道在问什么?如果说是new的问题,可以catch,用new_handler

【在 X****r 的大作中提到】
: 不知道在问什么啊。
1 (共1页)
进入Programming版参与讨论
相关主题
弱问一个Is the order of initialization a, b, c or c, b, a?
c++ private 问题一个c++ constructor的问题, thanks
VC里怎样主动关闭一个弹出的菜单?question about Design Patterns
用STL map的时候怎么自己定义大小比较的关系c++ question
请教几个C++问题what is the difference?
Synthesized Constructor到底什么意思?问个构造函数的问题
[合集] 又学了一招菜鸟请教smart pointer
请教个Bloomberg 的 C++ 题目how to create interface "operator=="
相关话题的讨论汇总
话题: 关于话题: return话题: false话题: 找出