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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:19:19+00:00 2026-06-01T18:19:19+00:00

I see a function definition that looks like this ClassName::Read(myObjectClass &temp) I’m trying to

  • 0

I see a function definition that looks like this

ClassName::Read(myObjectClass &temp)

I’m trying to call it like this:

myObjectClass *myObj;
ClassName::Read(&myObj);

but that is incorrect. What is the proper way to call it? It needs to be of type myObjectClass&

  • 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-06-01T18:19:20+00:00Added an answer on June 1, 2026 at 6:19 pm

    As James correctly points out, the correct syntax is *myObj. The point is that &myObj gives you the address of myObj, which has a type of myObjectClass**. You want instead to dereference myObj to get at the instance of myObjectClass to which it points, hence you use *.

    Incidentally, as it stands at the moment, using *myObj would cause undefined behaviour, since myObj itself has not been initialised. If you don’t need to dynamically allocate a myObjectClass, you might be better off just doing this:

    myObjectClass myObj;
    ClassName::Read(myObj);
    

    If dynamic allocation is a must, then you can do e.g.

    myObjectClass *myObj = new myObjectClass;
    ClassName::Read(*myObj);
    //...
    delete myObj;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class definition that looks like this: public class SolrObj { [SolrUniqueKey(id)]
I see C books that use the same variable names in the function definition,
I'm trying to call the OpenThemeData (see msdn OpenThemeData ) function but I couldn't
I see a lot of code like this: function Base() {} function Sub() {}
I have a block of code that looks like this: def create_page_object(url) begin page
Trying to write a function to see how often an object exists and give
Can anyone see anything wrong with this login script: public function login($username, $pass, $remember)
Can I see the translated machine instruction of a scheme function like (disassemble) in
I have some POD that looks like =head2 C<close() on unopened filehandle %s> =over
I've just found this function definition in some embedded code: float round_float_to_4(static float inputval);

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.