AnthonyPython Posted February 26, 2015 Posted February 26, 2015 to go into but more explanation of what question I am asking is, why does &World::Clear; work instead of World::Clear; Intelleasense said to put a & in front but why does it not work without a & symbol? Quote OS: Windows 10 Pro CPU: i3-10100 CPU @ 3.60GHz GPU: NVIDIA 2060 Super - 8 GB RAM: 32 GB
Roland Posted February 26, 2015 Posted February 26, 2015 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(); Quote Roland Strålberg Website: https://rstralberg.com
AnthonyPython Posted February 26, 2015 Author Posted February 26, 2015 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. :/ Quote OS: Windows 10 Pro CPU: i3-10100 CPU @ 3.60GHz GPU: NVIDIA 2060 Super - 8 GB RAM: 32 GB
AggrorJorn Posted February 26, 2015 Posted February 26, 2015 You might also want to read up on C++ pointers. http://www.cplusplus.com/doc/tutorial/pointers/ Quote
Guppy Posted February 26, 2015 Posted February 26, 2015 & (ampersand if you want to google it ) has 2 functions in C++ 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; When used infront of an existing variable it takes the address of the object ( effectively turning it into a pointer ) 1 Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k
AnthonyPython Posted February 26, 2015 Author Posted February 26, 2015 & (ampersand if you want to google it ) has 2 functions in C++ 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; 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.) Quote OS: Windows 10 Pro CPU: i3-10100 CPU @ 3.60GHz GPU: NVIDIA 2060 Super - 8 GB RAM: 32 GB
Guppy Posted February 26, 2015 Posted February 26, 2015 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. 1 Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k
AnthonyPython Posted February 26, 2015 Author Posted February 26, 2015 It suggests that you either accidentally used uppercase for world (World) or that the variable "world" was not in scope. Yea I used World instead, anyways though thanks for the cool info Guppy as usual Quote OS: Windows 10 Pro CPU: i3-10100 CPU @ 3.60GHz GPU: NVIDIA 2060 Super - 8 GB RAM: 32 GB
Recommended Posts
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.