We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← All tracks
0 / 4
References, Pointers, Ownership
C++Who owns this, and who is merely looking at it — answered in the signature with a type rather than in a comment nobody reads.
This track is written for C++, which isn't the mode you're browsing in.
0
/ 4 solved
- 1. Not solved yet. Say it in the signature
- 2. Not solved yet. A raw pointer owns nothing
- 3. Not solved yet. The gap between new and the smart pointer
- 4. Not solved yet. Two owners, and neither one ever leaves
Check yourself
4 questions · one attempt eachThese do not count toward finishing the track. They are here to catch the things that are easy to read past.
Base has virtual functions but a non-virtual destructor. What happens on delete b?
struct Base { virtual void f(); }; // no virtual ~Base
struct Der : Base { std::vector<int> big; ~Der(); };
Base* b = new Der();
delete b;
Question 1 of 4