How to pass the IKinectSensor value from one class to another class RRS feed

  • Question

  • I am new to Kinect SDK and C++. I was trying to do the following but getting error as access violation.

    I have got the IkinectSensor value by using the function GetDefaultKinectSensor function in one class where i have used it to get Color and depth Frame Source. Now i want to pass this sensor value to another class where i want to use this sensor value to get BodyFrameSource. I have like below in my code.

    IN Class A:

    IKinectSensor* m_sensor;

    hr = GetDefaultKinectSensor(&m_sensor);

    ClassB thisClassB(&m_sensor, m_coordinateMapper); // I want to pass the values of sensor and coordinate mapper to Class B                                                                                          through constructor.

    IN Class B:
    ClassB(IKinectSensor** sensor, ICoordinateMapper** coordinateMapper){m_sensor = sensor, m_coordinateMapper = CoordinateMapper}   //Assigned to a private values of Class B 

    I would Like to know is it possible to do what i want. If so how can they be passed and assigned in Class B. 

    Please help me in understanding how it can be done.

    Thank You

    Saturday, October 1, 2016 10:56 PM