Sign in to follow this  

declaring skybox

This topic is 3591 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

how do i declare m_skybox.Initialize(); in the header file? it wont let me have '.' tokens and wants a primary expression before them in the .cpp file so i made a new class for skybox class m_skybox { should i have 'public:' here? or private? m_skybox(); ~m_skybox(); // now i want to declare .Initialize() so.. m_skybox.Initialize(); // but that doesnt work. by having this class it declares the skybox but i do not know how to have .Initailize(); in the header without need primary expressions before the '.' token in the .cpp file.

Share this post


Link to post
Share on other sites
First off, your expression for the Initialize() method is trying to make a call to that method within the class definition when you are wanting to define it. While I disagree with your naming conventions and the whole bit, I have reworked this below as a full class definition and followed it up with the code to implement the Initialize method.


class m_skybox
{
// Que 1: Should I have 'public' here or 'private'
// Ans 1: As you only have one constructor this should be public
public:

m_skybox();
virtual ~m_skybox();

// now i want to declare .Initialize() so..
void Initialize( void );
};

//Now if you want to actually implement the Initialize function...
// (notice it is outside the class declaration)
void m_skybox::Initialize( void )
{
}

// and after you have created an object of type m_skybox you call it this
// way for a declaration on the stack (ex. within your main)
m_skybox variableName;
variableName.Initialize();





Ok, with that out of the way I HIGHLY recommend you review online articles or purchase a book on C++ development particularly as it pretains to object oriented programming as I can see by your questions and implementation that you do not fully understand how to declare, implement and use the class you are attempting to write. You could just copy/paste this code into your application and it would work as-is but without understanding of object-oriented programming as a whole this really won't make a whole lot of sense.

Best of luck!

Share this post


Link to post
Share on other sites

This topic is 3591 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this