class Buffer {
public:
Buffer(size_t s) {
Serial.println(F("constructor"));
if (s < 100) size = 100;
else if (s < 200) size = 200;
else size = 300;
}
~Buffer() {
Serial.print(F("destructor for size: "));
Serial.println(size);
}
private:
size_t size;
};
Buffer* createBuffer(size_t n) {
Serial.println(F("entering function"));
Buffer b(n);
Serial.println(F("just before return"));
return &b;
}
void setup() {
Serial.begin(115200); Serial.println();
Serial.println(F("before createBuffer"));
createBuffer(80);
Serial.println(F("after createBuffer"));
}
void loop() {}