CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Join Date
    Sep 2008
    Posts
    113

    Re: Instantiating before the body is called?

    That makes sense. But I always find myself glancing at the private member so I know what's what before I look at the public part.

  2. #17
    Join Date
    Aug 2007
    Posts
    858

    Re: Instantiating before the body is called?

    Quote Originally Posted by Raislin View Post
    That makes sense. But I always find myself glancing at the private member so I know what's what before I look at the public part.
    You really shouldn't need to know or care anything about the internals of a class in order to use it. If you're looking at private members, you're going to be trying to figure out how the class does what it does in order to understand them... which kind of defeats the whole purpose of using a public interface to hide the implementation.

  3. #18
    Join Date
    Sep 2008
    Posts
    113

    Re: Instantiating before the body is called?

    I think that if I did only care about the public interface, then I wouldn't care about the internals. Thus far, however, I've only encountered code where I am interested in the internal implementation (not completely true, if I consider the STL) as a way of learning. I've already started changing the way I organize my classes so that I can work on reorganizing the way I think about them, just in case.

  4. #19
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Instantiating before the body is called?

    Quote Originally Posted by Raislin
    I think that if I did only care about the public interface, then I wouldn't care about the internals. Thus far, however, I've only encountered code where I am interested in the internal implementation (not completely true, if I consider the STL) as a way of learning.
    In that case you are playing the role of a maintainer of the class, even though you are not actually maintaining it
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  5. #20
    Join Date
    Sep 2008
    Posts
    113

    Re: Instantiating before the body is called?

    I suppose that's true! However, I had an interesting experience while "not maintaining" the code in this textbook. It teaches how to build a game physics engine. I found what I thought were errors in the code (and the math!), but I kept second guessing myself because I figured the textbook was more likely to be correct than myself.

    I ran a demo that comes with the book that utilizes the code and it appears to run fine. But it turned out the mistakes were definitely there and the consequences were subtle. It bugged me the heck out of me until I figured out what was wrong.

    So, as a "maintainer," I managed to fix some of the code while not actually maintaining it.

    Sorry, I haven't been sleeping well lately. Rather, I haven't really been sleeping at all, so that may be coming out in my writing.

Page 2 of 2 FirstFirst 12

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured