Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 1991589

@User 1991589
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Object cloning
    U User 1991589

    Dear all, Consider the following code:

    class Person
    {
    Person *parent;

    public:
    Person(Person *p){parent = p;}

    };

    int main()
    {
    Person grandfather(nullptr);
    Person father(&grandfather);
    Person son(&father);

    // Do something here
    
    return 0;
    

    }

    The inter-object relationship works fine, as long as I don't pass the objects around as function arguments (e.g. pass by value) or clone the objects. If I want to pass them as function parameters, or make a clone of the three objects, without breaking their relationships, what should I do? Thanks. Milan.

    C / C++ / MFC question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups