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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:27:23+00:00 2026-05-14T23:27:23+00:00

Let say we have a class MyClass that has and a memberfunc(). An object

  • 0

Let say we have a class MyClass that has and a memberfunc().
An object is created for this MyClass, say ObjA.

i.e MyClass ObjA;

ObjA calls memberfunc().

Can we get this name ‘ObjA’ inside memberfunc() programatically?

Note: I know how to get the type of the object, i.e ‘MyClass’, using RTTI (Run-Time Type Identification), the same is also explained by radman below.

EDIT:

If this is NOT POSSIBLE in c++, Is it possible in any other programming language?

EDIT2

Made some modification to the question as few were unable to interpret.

  • 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-14T23:27:24+00:00Added an answer on May 14, 2026 at 11:27 pm

    There are several issues here:

    1. Objects don’t call anything, code does.
    2. Objects don’t have a name. An object is usually assigned to a variable, often to more than one variable, often to no variable at all, such as an array element.
    3. Getting access to the call stack might give you some idea of the calling class that owns the code that called you, but even this usually requires a level of introspection that goes beyond the reflection facilities of most languages.
      • Python is a notable exception. It can give you the stack to walk and figure out lots of interesting things. C++ won’t.

    I have seen C++ libraries that crack open the stack (this is very non-portable, by the way) and thus give code the ability to figure stuff out like, “Who called me?” but I haven’t used that stuff for years.

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

Sidebar

Related Questions

Let's say I have the following code: class MyClass(object): def __init__(self, param): self.param =
Okay so let's say I have class A... CLASS A has a method that
Let's say we have a class that embed another parametric one, that has to
Let's say I have a class that has 3 properties. I don't know which
Let's say I have a class like this: class Test(object): prop = property(lambda self:
Let's say I have a class that has a MyCustomDatabaseAccess as a data member.
Let's say I have a class that implements the IDisposable interface. Something like this:
Let's say I have a class like this : public class MyClass { public
Let's say I have a Java class like this: public class MyClass { public
Let's say, I have this class public class MyClass { public int MyMethod(int? i)

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.