G*n
2 楼
请教OOP的C++问题
一个class A里面有virtual function fun(),现在把A作为一个interface.
然后让B,C,D....继承A,并且overwrite这个virtual function.
现在有一个数组是vector,当然vector里面可能是B,C,D,...任意一个class。
如果要做一个循环处理这个vector,如何知道vector里的每一个element是B,C,D中的
哪一个呢?因为要处理fun()的返回值,想知道每个element是哪个class。
一个class A里面有virtual function fun(),现在把A作为一个interface.
然后让B,C,D....继承A,并且overwrite这个virtual function.
现在有一个数组是vector,当然vector里面可能是B,C,D,...任意一个class。
如果要做一个循环处理这个vector,如何知道vector里的每一个element是B,C,D中的
哪一个呢?因为要处理fun()的返回值,想知道每个element是哪个class。
a*s
3 楼
rt,best buy网上买他们自己的GC,每次250刀,怎么买到第三单就再也买不下去了,
有什么秘诀吗,多谢!
还是说每账户每日有limit?
另外一个household开两个bb账户的话,可以买成功吗,谢谢!
有什么秘诀吗,多谢!
还是说每账户每日有limit?
另外一个household开两个bb账户的话,可以买成功吗,谢谢!
x*i
4 楼
On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
approved. You will be notified of the decision by mail. Please check our
website at www.uscis.gov for further updates on your case, including when
the approval notice is mailed. If you do not receive the approval notice
within 30 days, please call customer service at 1-800-375-5283 for further
assistance.
pp的但从来没看见clock开始之类的,不知道怎么回事……
approved. You will be notified of the decision by mail. Please check our
website at www.uscis.gov for further updates on your case, including when
the approval notice is mailed. If you do not receive the approval notice
within 30 days, please call customer service at 1-800-375-5283 for further
assistance.
pp的但从来没看见clock开始之类的,不知道怎么回事……
H*r
5 楼
white house
p*e
6 楼
返回值的struct里包含类的名字信息就行了啊
【在 G***n 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 请教OOP的C++问题
: 一个class A里面有virtual function fun(),现在把A作为一个interface.
: 然后让B,C,D....继承A,并且overwrite这个virtual function.
: 现在有一个数组是vector,当然vector里面可能是B,C,D,...任意一个class。
: 如果要做一个循环处理这个vector,如何知道vector里的每一个element是B,C,D中的
: 哪一个呢?因为要处理fun()的返回值,想知道每个element是哪个class。
【在 G***n 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 请教OOP的C++问题
: 一个class A里面有virtual function fun(),现在把A作为一个interface.
: 然后让B,C,D....继承A,并且overwrite这个virtual function.
: 现在有一个数组是vector,当然vector里面可能是B,C,D,...任意一个class。
: 如果要做一个循环处理这个vector,如何知道vector里的每一个element是B,C,D中的
: 哪一个呢?因为要处理fun()的返回值,想知道每个element是哪个class。
a*s
7 楼
rere
u*e
8 楼
gongxi, 是批了。
s*h
9 楼
卡神环游世界到dc了.
s*s
11 楼
cong~~~~~~~~
【在 x***i 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
【在 x***i 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
s*t
14 楼
big cong!!!
v*9
16 楼
可以不需要typeid,不过就比较奇怪一点。
tester.h
================
class A{
public:
virtual void invoke();
};
class B:public A{
public:
void virtual invoke();
};
class C:public A{
public:
void invoke();
};
class D:public A{
public:
void invoke();
};
=====================
main.cpp
=====================
#include
#include
#include "tester.h"
using namespace std;
void test(A* a){
cout<};
void test(B* a){
cout<};
void test(C* a){
cout<};
void test(D* a){
cout<};
void A::invoke(){
cout<test(this);
}
void B::invoke(){
cout<test(this);
}
void C::invoke() {
cout<test(this);
}
void D::invoke() {
cout<test(this);
}
int main(int argc, const char * argv[])
{
vector vec;
B b;
C c;
D d;
vec.push_back(&b);
vec.push_back(&c);
vec.push_back(&d);
for(auto obj: vec){
obj->invoke();
}
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
======================
tester.h
================
class A{
public:
virtual void invoke();
};
class B:public A{
public:
void virtual invoke();
};
class C:public A{
public:
void invoke();
};
class D:public A{
public:
void invoke();
};
=====================
main.cpp
=====================
#include
#include
#include "tester.h"
using namespace std;
void test(A* a){
cout<};
void test(B* a){
cout<};
void test(C* a){
cout<};
void test(D* a){
cout<};
void A::invoke(){
cout<test(this);
}
void B::invoke(){
cout<test(this);
}
void C::invoke() {
cout<test(this);
}
void D::invoke() {
cout<test(this);
}
int main(int argc, const char * argv[])
{
vector vec;
B b;
C c;
D d;
vec.push_back(&b);
vec.push_back(&c);
vec.push_back(&d);
for(auto obj: vec){
obj->invoke();
}
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
======================
V*A
17 楼
gxgx!
big bless!
big bless!
s*n
19 楼
这个设计听起来不怎么oop,为什么要知道type,能抽象出来吗
【在 G***n 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 请教OOP的C++问题
: 一个class A里面有virtual function fun(),现在把A作为一个interface.
: 然后让B,C,D....继承A,并且overwrite这个virtual function.
: 现在有一个数组是vector,当然vector里面可能是B,C,D,...任意一个class。
: 如果要做一个循环处理这个vector,如何知道vector里的每一个element是B,C,D中的
: 哪一个呢?因为要处理fun()的返回值,想知道每个element是哪个class。
【在 G***n 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 请教OOP的C++问题
: 一个class A里面有virtual function fun(),现在把A作为一个interface.
: 然后让B,C,D....继承A,并且overwrite这个virtual function.
: 现在有一个数组是vector,当然vector里面可能是B,C,D,...任意一个class。
: 如果要做一个循环处理这个vector,如何知道vector里的每一个element是B,C,D中的
: 哪一个呢?因为要处理fun()的返回值,想知道每个element是哪个class。
m*n
20 楼
big cong!!!
z*f
21 楼
http://www.dc495.com/wiki/index.php?title=Visiting_DC
【在 z***f 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: dc495.com ... haha
【在 z***f 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: dc495.com ... haha
s*7
22 楼
gxgx!
S*t
24 楼
CONG, BAOZI
l*7
26 楼
恭喜,吃包子
k*r
27 楼
good good. thx~
【在 z***f 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: http://www.dc495.com/wiki/index.php?title=Visiting_DC
【在 z***f 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: http://www.dc495.com/wiki/index.php?title=Visiting_DC
e*p
28 楼
Big cong!
S*y
30 楼
恭喜
L*n
32 楼
恭喜, 求背景
j*1
33 楼
Capitol
白宫要提前半年预约吧
白宫要提前半年预约吧
i*n
34 楼
cong.
baozi
baozi
w*e
36 楼
cong!
d*i
37 楼
搭车问,现在白宫对外开放么?可以提前申请么?
S*n
38 楼
cong!
【在 x***i 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
【在 x***i 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
s*i
40 楼
cong!
l*n
42 楼
congrats, 包子
s*s
44 楼
cong!
c*4
45 楼
来华盛顿州玩了又去华盛顿首府,好羡慕。上次没有去拜访梦老让请吃大餐?
l*4
46 楼
Big cong!
L*S
48 楼
gxgx
k*g
49 楼
BIG CONG!
n*g
50 楼
big con
m*5
51 楼
Cong~~~~~~~
【在 x***i 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
【在 x***i 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
gv
52 楼
gxgx
H*1
53 楼
批了。恭喜
【在 x***i 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
【在 x***i 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
s*u
54 楼
cong!!
p*y
55 楼
来学习的,也恭喜楼主阿
a*n
56 楼
gx
n*y
57 楼
Cong~
【在 x***i 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
【在 x***i 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
E*A
58 楼
恭喜
c*t
59 楼
gongxi
【在 x***i 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
【在 x***i 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
b*j
60 楼
cong~~
s*8
61 楼
Big cong
★ 发自iPhone App: ChineseWeb 7.5
【在 x***i 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
★ 发自iPhone App: ChineseWeb 7.5
【在 x***i 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: On February 15, 2013, your I140, IMMIGRANT PETITION FOR ALIEN WORKER was
: approved. You will be notified of the decision by mail. Please check our
: website at www.uscis.gov for further updates on your case, including when
: the approval notice is mailed. If you do not receive the approval notice
: within 30 days, please call customer service at 1-800-375-5283 for further
: assistance.
: pp的但从来没看见clock开始之类的,不知道怎么回事……
A*n
62 楼
cong
c*6
63 楼
gxgx
C*d
64 楼
gxgx!
k*r
65 楼
cong!
f*s
66 楼
cong
g*u
67 楼
恭喜
d*7
68 楼
great news, Congrat
y*o
69 楼
恭喜
l*s
70 楼
gxgx
b*e
71 楼
恭喜恭喜,包子~~~
x*i
72 楼
不好意思,散尽家财过一次,包子没了
t*m
74 楼
大大恭喜!谢谢分享tips,很有用!
d*7
75 楼
半绿了,恭喜恭喜!
T*8
76 楼
恭喜!
b*j
77 楼
big cong!!!
v*o
78 楼
gx!
k*g
79 楼
BIG CONG!
相关阅读
【审稿机会】纳米材料[GONE] Reviewer wanted [Renal function, Hemodynamics]今天都是4月下旬甚至5月的人报绿啊指纹没过关!请教485的若干问题,新手,莫笑eb1-b材料打印问一个review的问题申请过程中要搬家怎么办?EB1a RFE推荐信求助eb1a 求评估citations: Google Scholar中的 working papers是不是可以计算在内?所做的东西,设计能源和环境领域,请问两个领域都要claim吗?审稿中编辑的support letter怎么写?FP notice只提到485和765,没有131的对么现在F1暑假回国, I-20表怎么处理?什么手续? (转载)今天EAD能批吗?对于eb1b申请,只报道了自己的工作没有提名字算媒体报道么?FP notice 收到大家walk in打指纹早上去还是下午去好阿需要在Exhihit里highlight评论你文章的话吗?