Jump to content

why &World::Clear; in C++?


AnthonyPython
 Share

Recommended Posts

Neither of them will work.

 

First of all you have to have an instance of the world

and then use the methods (functions) on that instance

 

World* myWorld = World::Create();
myWorld->Clear();

 

Intellasense does some strange stuff some times. :/

OS: Windows 7

Processor: AMD A6-3420M APU integrated Radeon HD Graphics 1.50 GHz

Link to comment
Share on other sites

& (ampersand if you want to google it ;) ) has 2 functions in C++

  1. When used during declaration of a variable it means said variable is a reference - that is any change made to it is made to the original also;
  2. When used infront of an existing variable it takes the address of the object ( effectively turning it into a pointer )

  • Upvote 1

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

& (ampersand if you want to google it wink.png ) has 2 functions in C++

  1. When used during declaration of a variable it means said variable is a reference - that is any change made to it is made to the original also;
     
  2. When used infront of an existing variable it takes the address of the object ( effectively turning it into a pointer )

 

 

ah ok

 

You might also want to read up on C++ pointers.

http://www.cplusplus.com/doc/tutorial/pointers/

 

whoa, that is a ton of info on pointer's xD (also btw I did

 world->Clear();

first but then intellesense wanted me to put &World::Clear; instead, Clearly I know that wasn't correct.)

OS: Windows 7

Processor: AMD A6-3420M APU integrated Radeon HD Graphics 1.50 GHz

Link to comment
Share on other sites

I did

 world->Clear();

first but then intellesense wanted me to put &World::Clear; instead, Clearly I know that wasn't correct.

 

It suggests that you either accidentally used uppercase for world (World) or that the variable "world" was not in scope.

  • Upvote 1

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...