Can someone explain how classes work as far as public and private classes when it comes to string constants

Answered Can someone explain how classes work as far as public and private classes when it comes to string constants

  • Tuesday, May 08, 2012 7:31 AM
     
     

    I have several books which explain classes and I have seen it explained online and it is still quite confusing.

    If classes are used to hide data suppose I wanted to hide the titles of these books from the user:

            "Travels in the Congo",
            "West African Studies",
            "Astronomical Almanac 2011",
            "C++: Starting Out with Early Objects",
            "OpenGL Programming Guide",
            "Mathematics for 3D Game Programming and Computer Graphics",
            "Engineering Problem Solving with C++"

    Then at some point in main() I would want to reveal them. Do I need to know about references and pointers to do this?


    matthew g mutch

All Replies

  • Tuesday, May 08, 2012 7:37 AM
     
     
    >suppose I wanted to hide the titles of these books from the user

    Which user? The user of your class (a programmer), or the user
    of your program?

    - Wayne
  • Tuesday, May 08, 2012 7:49 AM
     
     

    The user of the program to start.

    An example of this would be a program designed for a library where a guest could access the list of books they checked out but other users of the same program could not access thier data.


    matthew g mutch



    • Edited by NK-7 Tuesday, May 08, 2012 8:05 AM
    • Edited by NK-7 Tuesday, May 08, 2012 8:05 AM
    •  
  • Tuesday, May 08, 2012 8:21 AM
     
     

    The user of the program to start.

    An example of this would be a program designed for a library where a guest could access the list of books they checked out but other users of the same program could not access thier data.

    That has nothing to do with "private" as it relates to
    C++ classes. That involves writing your code so that it
    requires a password or user ID (library card number) as
    input, and restricting data access accordingly.

    - Wayne

  • Tuesday, May 08, 2012 8:27 AM
     
     

    What would be an example of needing to hide a string from the user of the program?

    What about in Encryption of data?


    matthew g mutch


    • Edited by NK-7 Tuesday, May 08, 2012 8:43 AM
    •  
  • Tuesday, May 08, 2012 8:51 AM
     
     Answered
    >What would be an example of needing to hide a string
    >from the user of the program?

    Don't you read your own posts? You just gave an example:
    a library circulation system.

    Or are you referring to making *embedded* strings that
    are in the exe obfuscated so that they can't be seen
    by looking at the bytes using a file viewer? e.g. -
    An embedded password or registration number.

    >What about in Encryption of data?

    What about it?

    - Wayne
    • Marked As Answer by NK-7 Tuesday, May 08, 2012 9:14 AM
    •  
  • Tuesday, May 08, 2012 9:03 AM
     
     

    Yes, I read my own posts. I was asking for code or where I could find the code or what I need to learn so that I can hide a string.

    And it seems as though the answer is embedded strings but just to make sure I will look it up...

    Also as far as encryption of data I am trying to justify the need for me to read up on such a complex subject. That is all.


    matthew g mutch