• Advertisement
Sign in to follow this  

Inherit problem

This topic is 4713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have made a CameraClass thar describes a simple camera. My second class inherits from the base class and is a free-looking camera. But when I try to get the camera's position of the free camera, I get this error: S:\PROGGING\Code\PutPixel Dx9b\main.cpp(168) : error C2248: 'vPos' : cannot access public member declared in class 'CDirect3DCamera' If it's public then it SHOULD be able to get it, right???

Share this post


Link to post
Share on other sites
Advertisement
Hmm, not sure. Did you make sure to use public inheritance?

class BaseCameraClass
{
public:
Vector2 vPos;
// ...
};

class DerivedCameraClass : public BaseCameraClass
{
public:
// ...
};

Share this post


Link to post
Share on other sites
[lol] Now that's a funny error. When you derived your class did you do it like this:

class base
{
public:

private:
}:

class derived : public base
{
public:

private:
};


If you just do:

class derived : base
{
public:

private:
};


That may cause a problem. If not, please post some code of how it is being done.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement