<aside> <img src="/icons/arrow-right-basic_lightgray.svg" alt="/icons/arrow-right-basic_lightgray.svg" width="40px" />

Les 1

📝 Belangrijke Syntax Snippets

// Dynamic cast
Derived* d = dynamic_cast<Derived*>(basePtr);
if (d) d->doSomething();

// Static variabele
class MyClass {
public:
    static int value;
};
int MyClass::value = 0; // Definitie buiten klasse

// Forward declaration
class AnotherClass; // Alleen verwijzing/pointer mogelijk

</aside>

<aside> <img src="/icons/arrow-right-basic_lightgray.svg" alt="/icons/arrow-right-basic_lightgray.svg" width="40px" />

Les 2

📝 Belangrijke Syntax Snippets

// Unique
std::unique_ptr<MyClass> ptr = std::make_unique<MyClass>();

// Shared
std::shared_ptr<MyClass> ptr = std::make_shared<MyClass>();
ptr.use_count(); // Geeft aantal shared_ptrs naar hetzelfde object

// Weak
std::weak_ptr<MyClass> wptr = ptr;
if (auto spt = wptr.lock()) {
    spt->doSomething();
}

</aside>

<aside> <img src="/icons/arrow-right-basic_lightgray.svg" alt="/icons/arrow-right-basic_lightgray.svg" width="40px" />

Les 3

📝 Belangrijke Syntax Snippets

// Vector
std::vector<int> v;
v.push_back(10);
v.emplace_back(20);
for (int x : v) std::cout << x << " ";

// List
std::list<int> l;
l.push_back(10);
l.push_front(5);
l.insert(l.begin(), 7);
l.remove(7);

</aside>