intro-to-zig-talk/c/raii.cpp
2024-08-08 20:39:18 +02:00

27 lines
283 B
C++

#include <iostream>
#include <vector>
class MyClass
{
public:
void* ptr;
MyClass()
{
ptr = malloc(sizeof(100000000));
}
~MyClass()
{
free(ptr);
}
};
MyClass myClass;
int main()
{
std::vector<MyClass> vec;
vec.push_back({});
}