Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 766745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T17:05:53+00:00 2026-05-14T17:05:53+00:00

Which one do you prefer to delete objects? Especially in QT, but other practices

  • 0

Which one do you prefer to delete objects? Especially in QT, but other practices are also welcome. These two alternatives seem same to me, are they?

  1. Bound to another class, and destroy when it is destroyed.

    SomeClass::SomeClass{
     socket_ = new QTcpSocket(this);
    }
    

or

  1. Destroy in the destructor of class

    SomeClass::SomeClass{
     socket_ = new QTcpSocket();
    }
    
    SomeClass::~SomeClass{
     delete socket_;
    }
    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T17:05:54+00:00Added an answer on May 14, 2026 at 5:05 pm

    When in Rome, do as the Romans do. If your framework uses one method (for example Qt relies on parent-child relationship), use this method in your code.

    Of course don’t forget about general good memory management practices: create object on stack whenever it’s possible, use shared pointers, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is difference between these two? Which one you would prefer when you need
Here's the situation I have a webpage which has one drop down called prefer.
Which one of these would be more suitable for RLE on bytes? I need
which one do you prefer? I want to make a finite automata in java;
Fluent NHibernate or NHibernate, Which one should we prefer for linq support?
Which one would you prefer to extract a sub-string from the given string and
For a rails CSS framework for an existing app, which one do you prefer
Which one do you prefer to store text in your database? The original casing
what is the different between this queries? which one should I prefer and why?
which one of the following is better? <c:set var=var1 value=false scope=request/> <c:if test=${someCondition}> <c:set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.