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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Accessing private Member

Accessing private Member

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
7 Posts 4 Posters 0 Views 1 Watching
  • 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.
  • B Offline
    B Offline
    baerten
    wrote on last edited by
    #1

    Hi everyone, i need to access a private Member of a friend class from a derived class LOL Class A with private Member AA Class B has a Member of kind pointer on class A So B can't access AA. Using the friend function friend class A, the class B can access AA All these classes are in a component, so i can't modify the source code. Now i derive the class B and call these class for example MyB In MyB i must also use the Pointer to the class A with his private Member. But then i get the error : C2248 I added also the friend class A to MyB. Anyone an idea? Big thanks

    A C 2 Replies Last reply
    0
    • B baerten

      Hi everyone, i need to access a private Member of a friend class from a derived class LOL Class A with private Member AA Class B has a Member of kind pointer on class A So B can't access AA. Using the friend function friend class A, the class B can access AA All these classes are in a component, so i can't modify the source code. Now i derive the class B and call these class for example MyB In MyB i must also use the Pointer to the class A with his private Member. But then i get the error : C2248 I added also the friend class A to MyB. Anyone an idea? Big thanks

      A Offline
      A Offline
      Aqueel
      wrote on last edited by
      #2

      C2248 isnt an error. Can you plz tell what is the error??

      We Believe in Excellence www.aqueelmirza.cjb.net

      D 1 Reply Last reply
      0
      • B baerten

        Hi everyone, i need to access a private Member of a friend class from a derived class LOL Class A with private Member AA Class B has a Member of kind pointer on class A So B can't access AA. Using the friend function friend class A, the class B can access AA All these classes are in a component, so i can't modify the source code. Now i derive the class B and call these class for example MyB In MyB i must also use the Pointer to the class A with his private Member. But then i get the error : C2248 I added also the friend class A to MyB. Anyone an idea? Big thanks

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        C2248 = members of a derived class cannot access private members of a base class.  That's all, if you cannot modify the source, then it can't be done, at least not without monumental hacking.

        A 1 Reply Last reply
        0
        • C Christian Graus

          C2248 = members of a derived class cannot access private members of a base class.  That's all, if you cannot modify the source, then it can't be done, at least not without monumental hacking.

          A Offline
          A Offline
          Aqueel
          wrote on last edited by
          #4

          Oh thanks Christian. I am working with Visual C++ since 4 years and now i have been informed that C2248 is an error code. :sigh:

          We Believe in Excellence www.aqueelmirza.cjb.net

          B 1 Reply Last reply
          0
          • A Aqueel

            Oh thanks Christian. I am working with Visual C++ since 4 years and now i have been informed that C2248 is an error code. :sigh:

            We Believe in Excellence www.aqueelmirza.cjb.net

            B Offline
            B Offline
            baerten
            wrote on last edited by
            #5

            Hi Aqueel, you have two sorts of errors: Compile Errors, which produces during the compilation, they start always with C and an ID Then you habe Linkage-Errors, they start with LNK and an ID Thanks Christian, so it's totally the problem of the Component-Support to resolve the problem :) Thanks anyway

            A 1 Reply Last reply
            0
            • B baerten

              Hi Aqueel, you have two sorts of errors: Compile Errors, which produces during the compilation, they start always with C and an ID Then you habe Linkage-Errors, they start with LNK and an ID Thanks Christian, so it's totally the problem of the Component-Support to resolve the problem :) Thanks anyway

              A Offline
              A Offline
              Aqueel
              wrote on last edited by
              #6

              Hi Baerten Thank you. That's great to know.

              We Believe in Excellence www.aqueelmirza.cjb.net

              1 Reply Last reply
              0
              • A Aqueel

                C2248 isnt an error. Can you plz tell what is the error??

                We Believe in Excellence www.aqueelmirza.cjb.net

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                Aqueel wrote:

                C2248 isnt an error.

                Sure it is.


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

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