Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. if using friend function and class we can access private data then how to avoid it ?

if using friend function and class we can access private data then how to avoid it ?

Scheduled Pinned Locked Moved Solved C++ Gurus
4 Posts 3 Posters 387 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    i know using friend function and friend class we can access private data

    then how to make this type of keyword to not access the private data for security purpose ?

    Christian EhrlicherC 1 Reply Last reply
    0
    • Q Qt embedded developer

      @Christian-Ehrlicher means there is no other way to avoid it.

      to avoid this i have to not use this friend keyword.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #4

      @Qt-embedded-developer
      If you want to access private data you use friend.
      If you do not use friend you cannot access private data.
      What is the question? No, you cannot access private data and yet not use friend, else what else would it be for? If there was a different keyword which did this we would say so...

      1 Reply Last reply
      1
      • Q Qt embedded developer

        i know using friend function and friend class we can access private data

        then how to make this type of keyword to not access the private data for security purpose ?

        Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by Christian Ehrlicher
        #2

        You describe the function of this keyword and use it but don't want it's functionality... So don't use it.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        Q 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          You describe the function of this keyword and use it but don't want it's functionality... So don't use it.

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by
          #3

          @Christian-Ehrlicher means there is no other way to avoid it.

          to avoid this i have to not use this friend keyword.

          JonBJ 1 Reply Last reply
          0
          • Q Qt embedded developer

            @Christian-Ehrlicher means there is no other way to avoid it.

            to avoid this i have to not use this friend keyword.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #4

            @Qt-embedded-developer
            If you want to access private data you use friend.
            If you do not use friend you cannot access private data.
            What is the question? No, you cannot access private data and yet not use friend, else what else would it be for? If there was a different keyword which did this we would say so...

            1 Reply Last reply
            1
            • Q Qt embedded developer has marked this topic as solved on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved