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

  • Home
  • SEARCH
  • 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 6745551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:13:08+00:00 2026-05-26T12:13:08+00:00

I do not know what methodology they use since the code base is huge

  • 0

I do not know what methodology they use since the code base is huge.

It defined a class like this:

class ABC {
    member_func(string c);
};

main() {
    ABC("").member_func("this random string");
}

What is the missing code that would enable us to call ABC("");?

I did not see any object of that class created anywhere.

  • 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-26T12:13:08+00:00Added an answer on May 26, 2026 at 12:13 pm

    That simply constructs an object of type ABC, but doesn’t initialize any permanent memory location with that object. I.e., the initialized object the call to the ABC constructor creates is a temporary, and is lost after the call since it is not constructed in a memory location that can be accessed after the call such as an automatic variable on the stack, a static memory location, etc. So the “missing” code to make a call like that usable in the “real-world” is to actual name an object that is constructed so that it can be accessed later… for example, something like ABC my_object(""); or ABC my_object = ABC("");.

    UPDATE: In the updated code you’ve posted, what’s taking place is again a temporary object of type ABC is being constructed, and then a non-static method of class ABC called member_func is being called on the temporary that was created by the call to ABC‘s constructor. Of course for this code to have any meaning in the “real world”, that call to member_func would have to contain some side-effect that would be visible outside of the class instance (i.e., the class instance could be containing a data-member that is a pointer to some shared memory object that the call then modifies). Since though from the code sample you’ve posted there does not seem to be any side-effects from the call, it’s for all intents and purposes a non-operation … a temporary ABC class instance is created, it has a method called on the instance, and then any reference to the instance is lost since it was not constructed in a memory location accessible from the current scope of main().

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

Sidebar

Related Questions

I would like to know your thoughts on whether this type of methodology could
I know many people who use computers every day, who do not know how
Somewhere some guy said (I honestly do not know where I got this from),
I do not know how many faces this problem. If I do programming in
I do not know what is the reason of this but I just installed
I honestly do not know what they are called. I have been unable to
I do not know why this is happening: [NullReferenceException: Object reference not set to
I do not know how to classify this question. Vaguely, its about using calculated
If you do not know what Pipe Viewer is (I did not know about
I do not know javascript right now but I am planning on learning it.

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.