Pass object of one class to another

  • Hi ,
    I have 2 classes A and B
    i want to send object of class A to B.

    now suppose if object of class A is ob1 and signal is

    Now in class B the slot is receiveFromA(A ob1)

    The problem is i dont want to include class A.h in class B.

    Without including A.h the prototype receiveFromA(A ob1) is invalid as class A is not included

    So my ques is.. Is there any way by which without including A. h in class B i can access the object of class A and call memeber functions of class A.

  • If you can change the parameters from objects to the pointers or the references then you can use a forward declaration in B.h and include A.h only in B.cpp

Log in to reply