Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Test {
- int a[];
- public:
- Test(int size);
- };
- Test::Test(int size) {
- a[size]; // this is wrong, but what can i do here?
- }
- class Test {
- int *a;
- public:
- Test(int size) {
- a = new int[size];
- }
- ~Test() { delete [] a; }
- private:
- Test(const Test& other);
- Test& operator=(const Test& other);
- };
- class Test
- {
- std::vector<int> a;
- public:
- Test(std::size_t size):
- a(size)
- {}
- };
- template <int N> class Test {
- int a[N];
- public:
- Test() { }
- };
- Test<5> test;
- Test<40> biggertest;
- std::vector<char> vec(10);
- memset(&vec[0], 0, vec.size());
Add Comment
Please, Sign In to add comment