Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "What does this program print?" on CodeWiki (https://codewiki.com/practice/predict/cpp/classes/predict-memberwise-copy/).
Context (verbatim from the page):
"""
#include <iostream>
class Counter {
public:
explicit Counter(int value) : value_(value) {}
void increment() { ++value_; }
int value() const { return value_; }
private:
int value_;
};
int main() {
Counter original{3};
Counter copy = original;
copy.increment();
std::cout << original.value() << ' ' << copy.value() << '\n';
}
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in cpp. Where you are unsure, say so.