Off Topic > Off Topic
Programming Megathread
Becquerel:
Woah
What does this mean?
SubDaWoofer:
okayokayokay
so you define a class, you can set private or public members (vars or funcs) inside the class and then you define the object name after the closing braces
then you can define functions outside the class by using (classname)::(funcname)?
and you need the :: to give the scope of the function of the class
SUSHI:
--- Quote from: Pecon on February 17, 2017, 05:36:57 PM ---
--- End quote ---
LOL
Foxscotch:
why do people so often like to say something like char *s instead of char* s
the way I see it is that the type is "a pointer to a char". therefore I feel like the asterisk should be part of the type. I really can't see any reason, logically, to prefer putting it on the variable name, other than maybe the fact that you'd be doing that to access the value later
in googling something to make sure I was correct, I saw that int *x, y results in an int pointer and then.... a plain int? so I guess that could be a reason to place the asterisks next to the variable name. int* x, y is a little unclear
but then I also think that placing multiple declarations on the same line is ugly
SetGaming:
--- Quote from: Foxscotch on March 09, 2017, 11:11:39 PM ---why do people so often like to say something like char *s instead of char* s
the way I see it is that the type is "a pointer to a char". therefore I feel like the asterisk should be part of the type. I really can't see any reason, logically, to prefer putting it on the variable name, other than maybe the fact that you'd be doing that to access the value later
in googling something to make sure I was correct, I saw that int *x, y results in an int pointer and then.... a plain int? so I guess that could be a reason to place the asterisks next to the variable name. int* x, y is a little unclear
but then I also think that placing multiple declarations on the same line is ugly
--- End quote ---
honestly the way I see it is that pointers aren't necessarily types, so it might be confusing for people who are learning types to put it as char* s
moreover, the way I read it is "a char pointer towards variable s" so it just works better for me with char *s