Results 1 to 10 of 23

Thread: Class related Stuff New Instancing

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10

    shg

    shg
    shg https://www.excelforum.com/excel-pro...ml#post4386387
    Me https://www.excelforum.com/excel-pro...ml#post4386398
    shg https://www.excelforum.com/excel-pro...ml#post4386400
    Me https://www.excelforum.com/excel-pro...ml#post4386409
    shg https://www.excelforum.com/excel-pro...ml#post4386454
    Me https://www.excelforum.com/excel-pro...ml#post4386461


    Me https://www.excelforum.com/excel-pro...ml#post4386623
    shg https://www.excelforum.com/excel-pro...ml#post4386857

    shg https://www.excelforum.com/excel-pro...ml#post4386901
    Me https://www.excelforum.com/excel-pro...ml#post4386909




    https://www.excelfox.com/forum/showt...ll=1#post24207



    When a procedure gets an object ByVal, it gets a copy of the pointer to the object. You are free to change the object, e.g.,
    rng(1,1).value = "bob"
    ... and free to to assign the pointer to a different object internal to the called routine, e.g.,
    set rng = rng.offset(1)
    ... but in the latter case, the pointer is unchanged in the calling routine; the called routine just changed the local copy.

    That is what I was trying to say ( And did a lot of times )
    That is the first time in 6 Months of saying it that someone else did
    Thanks so much
    Sorry if I may have used the word "Copy” a bit out of context once when I meant that “local Copy”
    I use the local Copy of the car at the destination airport.
    The Original Copy I left with the Wife, bless him
    There is a fundamental difference between a copy of a pointer and a copy of an object. I don't think you've got your brain around that.
    I think I have... At least for a Laymen I have a pretty good understanding of the difference. If you have time to read my previous post and others elsewhere you will see that.
    But I confess that i do not understand it to the level of understanding that you may have.
    I think for my uses i have a good enough and correct enough understanding.
    ( Post #20 from you was a “God Send”. I have put through exactly that argument / explanation more times than I can remember, and that is the first time I had a response to it or some suppot in it
    Thanks once again )
    But f you could give a better one, when you have the time, it could be a great contribution to the Thread.
    Alan
    And I would say again... you do make a local Copy of an Object..( and everything else ) .
    No, Alan. The only thing there is a copy of is a four-byte pointer.
    It is not possible ( for me )to follow these little tit bits of info, sorry.
    Post # 20 was great. I will stick with that
    Thanks again
    Alan


    _.___________
    For example this might have been a typo...
    When a procedure gets an object ByVal, it gets a copy of the pointer to the object. You are free to change the object, e.g.,
    rng(1,1).value = "bob"
    ... and free to to assign the pointer to a different object internal to the called routine, e.g.,
    set rng = rng.offset(1)
    ... but in the latter case, the pointer is unchanged in the calling routine; the called routine just changed the local copy.
    Or if not a typo then that is lost in the uncertainty about exactly what a pointer is in this context.
    _ Did he mean the original object or that and the original pointer
    _ Is he talking about the part of the Pointer which contains info about things like the Address.
    _ And did he mean to say at the end local copy object or local copy pointer, or both...
    But again I am repeating my suggestions. And you know the game: I re explain and re explain then get moaned at that the thread is long and hard to follow
    Last night someone with the best intentions came in to help, but had not had time to read thoroughly and see the issues. I ended up having to explain his own explanations in his own Web Site., !! No offence there at all what so ever. I am very grateful for the effort. But once again a vicious circle. The Thread gets longer .. and I repeat ... and ... then....
    It is not a typo.
    Thanks for that.
    No offence, I am very grateful for your help.
    But, as I mentioned before, it makes things very difficult when you give such short answers like this.
    ( maybe you are just amusing yourself ?- why not – your well earned privilege )

    So It is not clear exactly what you are referring to there as the local copy.
    I could guess that could be the local copy of the Pointer?
    But is this "Pointer" somewhere ( maybe in a Pigeon Hole or whatever )
    So is "that" then effectively changed, or the contents there in. ?
    Such a thing could be the “Local Variable Copy” ( Just not to upset Rory I will emphasise it is not a Copy of the Object , in the same sense that for example, something like a Long number it would be the local Copy Variable that would also be a copy of everything to do with a Long Number. So it would be a Copy of the Long Number. In the case of the Object this Local Copy Variable is a Copy of the Pointer and is itself somehow an “Object” or else we could not change it within the called routine
    _......
    I suspect you "know" what you are talking about.
    I, and i bet many others , sadly do not
    It would be so great if you could expand a bit on what you said, preferably in terms a Laymen like me could understand
    And if not, thanks anyway again for coming back here.
    I myself ( in my profession ) had many frustrating hours trying to explain things that were obvious to me to others who had no idea.
    I feel your pain
    Alan
    An object pointer is a memory address that points to an object (more precisely, its vTable (Virtual Function ~), which contains the names of the object's properties and methods, the arguments they require, and their entry points (memory addresses)).

    When an object is passed by reference, the same pointer used by the calling procedure is passed to the called procedure. If the called procedure changes the pointer (by assigning it to a different object), that change is reflected in the calling procedure when the called procedure terminates.

    When passed by value, the calling procedure passes a COPY of the pointer. The called procedure can still do anything it likes, including changing (its local copy of) the pointer, but the copy is discarded when the called procedure terminates, so the calling procedure's pointer is unchanged
    .

    yeah, we got that bit. Thanks.
    Rory 15 May 2024 A pointer is a Long (or LongPtr on 64bit Office). The number it contains is a memory address (to the vTable of whichever interface was declared for the object variable, since an object can implement more than one). So passing it ByRef or ByVal is the same as passing a Long.
    Last edited by DocAElstein; 06-07-2024 at 12:41 PM.

Similar Threads

  1. Class related Stuff Userforms
    By DocAElstein in forum Test Area
    Replies: 29
    Last Post: 06-08-2024, 01:22 PM
  2. Class Stuff: VBA Custom Classes & Objects, Class Modules
    By DocAElstein in forum Excel and VBA Tips and Tricks
    Replies: 29
    Last Post: 06-02-2024, 01:49 PM
  3. Replies: 42
    Last Post: 05-29-2023, 01:19 PM
  4. Gif Image Video stuff testies
    By DocAElstein in forum Test Area
    Replies: 13
    Last Post: 09-06-2021, 01:07 PM
  5. Test my rights , to do stuff
    By TestAccount in forum Test Area
    Replies: 0
    Last Post: 10-07-2020, 11:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •