Note that there are some explanatory texts on larger screens.

plurals
  1. USDouble Dan
    primarykey
    data
    text
    plurals
    1. This table or related slice is empty.
    1. COThe problem is not being able to use the virtual functions i already have (like finalizeParts in the example) in my destructors. These are mostly function that destroy/clean up something or remove a child object from a parent object. All of these can happen during the life of an object as well. My weird implementation allows me to use these functions in my base class 'destructor'(finalize()) while the polymorphism still works as expected. Maybe the question would have been clearer without proposing an unusual solution at the same time.
      singulars
    2. COI know destructors in C++ work this way, I just don't like it. In the case of my example, if I have 50 derived classes like Subtest, every one of them that overrides finalizeParts() would need it's own destructor calling finalizeParts (which will clean up members of the baseclass as well through BaseTest::finalizeParts()). After that, should the destructor of BaseTest call finalizeParts as well? I don't see how this will work.
      singulars
    3. COThanks for mentioning lambda functions. I had no idea these exist (still learning C++ and Objective C). Imo the ultimate solution would be some kind of templates event class that allows me to define events like "anEvent<int, SomeObject*, bool>" with overloaded operators for registering handlers and calling the event. Lambda functions or objective C blocks might save me the overhead of wrapping my objective C method calls in C functions or separate classes. Since i'm still learning i have no way of quickly implementing this solution. Guess i have some studying to do first.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload