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 7643547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:28:36+00:00 2026-05-31T09:28:36+00:00

I have a little simple question. Let’s say I have a data object with

  • 0

I have a little simple question.

Let’s say I have a data object with about 10 properties, and I want to pass data from my object to a function.
Most of the time I only need one of these values in the receiving function, and could just as well pass only that value (let’s say an int). So what is the pros and cons with always sending the whole object vs only sending one of the contained values?

Is there a best practice?

  • 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-31T09:28:37+00:00Added an answer on May 31, 2026 at 9:28 am

    When you “pass an object”, you are actually just passing the reference to the object – so 4 bytes on x86 and 8 bytes on x64. So if the method feels natural to take the object, just pass the object; that’s fine. Any other approach is probably going to be worse.

    Of course, if it feels “natural” that the method only needs a single int, and could only ever need the single int, then passing an int is fine too.

    My point is: write the method to support what makes sense for the method.

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

Sidebar

Related Questions

A little stuck here. I have a simple question I guess. Given the following
I have a simple little test app written in Flex 3 (MXML and some
I have a simple little code fragment that is frustrating me: HashSet<long> groupUIDs =
I have a little problem with a simple vbScript. The script has to run
My problem is a little bit hard but simple. I have (or there is)
i have little problem with boost::asio library. My app receive and process data asynchronously,
I have little bit longer question for you - but hope answer will be
I have a simple question, I'm trying to make an huge game for Windows
This question is a little different from the others I've found here. My In
Background Let's say I have the following class: public class MyValue<T> { public T

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.