object-destruction Questions

4

I have a main program (main.cpp) and a shared library (test.h and test.cpp): test.h: #include <stdio.h> struct A { A() { printf("A ctor\n"); } ~A() { printf("A dtor\n"); } }; A& get...
Noaccount asked 6/2, 2019 at 21:34

3

Solved

Is it possible to delete an object form inside its class? class A(): def __init__(self): print("init") self.b="c" def __enter__(self): print("enter") return self def __exit__(self, type, va...
Rectum asked 28/9, 2018 at 8:39

3

Solved

Is there any way to call a field destructor before the class destructor? Suppose I have 2 classes Small and Big, and Big contains an instance of Small as its field as such: class Small { public: ...
Crowns asked 26/7, 2017 at 15:24

6

Solved

This is mostly out of curiosity. I was wandering if anyone has encountered any good usage for Object.finalize() except for debugging/logging/profiling purposes ? If you haven't encountered ...
Marcellemarcellina asked 18/11, 2010 at 13:13

6

Solved

Effective Java says : There is a severe performance penalty for using finalizers. Why is it slower to destroy an object using the finalizers?
1

© 2022 - 2024 — McMap. All rights reserved.