在java中类似于一个类 [英] similiar class to one in java

查看:69
本文介绍了在java中类似于一个类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道c ++中是否有类似java''arraylist'的东西'


和arraylist的工作原理就像一个数组excpet,你可以继续改变它的大小而不会导致任何问题



谢谢,

ken

i was wondering if there is anything in c++ that resembles a java ''arraylist''

and arraylist works exactly like an array excpet you can keep changing its size without causing any problems


thanks,
ken

推荐答案

我建​​议调查向量



i想知道c ++中是否有类似java''arraylist'的东西''


和arraylist的工作原理就像一个数组expet你可以继续改变它的大小而不会造成任何问题



谢谢,

ken
i was wondering if there is anything in c++ that resembles a java ''arraylist''

and arraylist works exactly like an array excpet you can keep changing its size without causing any problems


thanks,
ken



对我来说听起来像是一个C ++向量。


#include< vector>

...

vector< int> foo;

foo.push_back(10);

int bar = foo [0];


编辑:对不起,我不知道它已经回答了

Sounds like a C++ vector to me.

#include <vector>
...
vector< int > foo;
foo.push_back(10);
int bar = foo[0];

Sorry, I wasnt aware it was already answered



编辑:对不起,我不知道它已经回答了
Sorry, I wasnt aware it was already answered



我想我在你做之前偷偷摸摸了:))

I think I snuck it in right before you did :)


这篇关于在java中类似于一个类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆