c++ 생성자 변수 초기화(?) 질문
글쓴이: siera1 / 작성시간: 수, 2014/08/13 - 7:39오후
정확하게는 생성자 변수 초기화 질문이 아니고, 변수 초기화 하는 자리에 있는 또 다른 클래스 명 때문에 질문합니다.
제가 c++ 코드가 어색하고 문법공부를 제대로 하지 않아서 초보적인 질문일 수 있습니다...
요즘 제가 보고 있는 오도메트리 오픈소스 중 일부인데요.
아래에 DepthSource라는 class가 있습니다.
class DepthSource { public: virtual bool haveXyz(int u, int v) = 0; virtual void getXyz(OdometryFrame * frame) = 0; virtual void refineXyz(FeatureMatch * matches, int num_matches, OdometryFrame * frame) = 0; // (생략) }
근데 다른 cpp 파일에 보니 DepthImage 라는 아래와 같은 애가 있습니다.
class DepthImage : public DepthSource { public: DepthImage(const CameraIntrinsicsParameters& rgb_camera_params, int depth_width, int depth_height); ~DepthImage(); /** * Set the depth image, a width x height array of distances, units given in * meters. Each pixel of the depth image corresponds to a point in the * rectified RGB image. */ void setDepthImage(const float* depth_data); virtual bool haveXyz(int u, int v) ; virtual void getXyz(OdometryFrame * frame); virtual void refineXyz(FeatureMatch * matches, int num_matches, OdometryFrame * frame); virtual double getBaseline() const { return 0; } //(생략) }
':' 요거 뒤에 있는 애는 변수 초기화라고 알고 있는데 저렇게 그냥 함수가 들어오면 뭔가요?
DepthImage를 생성하면 DepthSource도 생성되는건가요?
http://msdn.microsoft.com/ko-kr/library/s16xw1a8.aspx 에 나온대로라면 DepthSource는 가상이라는 말인지..
그러면 DepthImage 클래스의 public: DepthImage 옆에 DepthSource도 있어야되는거 아닌가요?
제가 결국 하고 싶은건 저 DepthSource라는 클래스 타입의 변수를 만들고 싶은것인데,
저렇게 DepthImage 클래스 생성할때 꼽사리처럼 생성이 되면 변수 선언은 어떻게 해야하는 건가요?
도와주세요!
Forums:
여기에서 public: 이란 접근 한정자를 지정하는
여기에서 public: 이란 접근 한정자를 지정하는 구문입니다.
그냥 C++입문서를 하나 읽으시는게 좋을텐데요...
아무리 다른 언어를해서 객체지향을 안다고 해도 C++은 반드시 입문서 정독해야만 쓸수 있는 언어입니다.
대충 배워서 대충 쓰다가는 그냥 망합니다.
댓글 달기