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. taking variable value to another class

taking variable value to another class

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
4 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.
  • M Offline
    M Offline
    Maynka
    wrote on last edited by
    #1

    Hello all, class A: Function x class B: Function y I have already declared object of class B in class A to access member function y of B.Now i have to access function x in class B.In fact i have to take the return value of one function of class A and give it as input to one function of class B.Then mutally creating objects is giving errors,how to overcome the above problem. Regards

    D E S 3 Replies Last reply
    0
    • M Maynka

      Hello all, class A: Function x class B: Function y I have already declared object of class B in class A to access member function y of B.Now i have to access function x in class B.In fact i have to take the return value of one function of class A and give it as input to one function of class B.Then mutally creating objects is giving errors,how to overcome the above problem. Regards

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

      Maynka wrote:

      I have already declared object of class B in class A to access member function y of B.Now i have to access function x in class B.In fact i have to take the return value of one function of class A and give it as input to one function of class B.Then mutally creating objects is giving errors,how to overcome the above problem.

      :confused: Why not show the actual class definitions? Your paraphrased version makes no sense.


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      1 Reply Last reply
      0
      • M Maynka

        Hello all, class A: Function x class B: Function y I have already declared object of class B in class A to access member function y of B.Now i have to access function x in class B.In fact i have to take the return value of one function of class A and give it as input to one function of class B.Then mutally creating objects is giving errors,how to overcome the above problem. Regards

        E Offline
        E Offline
        Emmanouil
        wrote on last edited by
        #3

        Why dont you derive one class from another so you can use the function y from class A for example? Have you declared pointers inside each class?

        1 Reply Last reply
        0
        • M Maynka

          Hello all, class A: Function x class B: Function y I have already declared object of class B in class A to access member function y of B.Now i have to access function x in class B.In fact i have to take the return value of one function of class A and give it as input to one function of class B.Then mutally creating objects is giving errors,how to overcome the above problem. Regards

          S Offline
          S Offline
          sheshidar
          wrote on last edited by
          #4

          Hi.. are you including header files in both classes, i mean.. in A.h #include "B.h" and in B.h #include "A.h" if u give so definately u will get errors, so include only in the first written class . and in secondly written class just define the first class class A; try this hope it works..

          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