Inner struct/class

Started by
13 comments, last by Twisol 15 years, 1 month ago
I don't see a problem with just doing this:

class Math{        // .. other stuff    public:        static const double PI;        // .. other stuff};// static initializationconst double Math::PI = 3.14;


PI is still local to Math, not in the global namespace. And you just use it as "Math::PI".

~Jonathan
Advertisement
Ah well thats just personal preferance, i prefer the dot operator to the scope resolution operator.

At the moment ive defined a PI struct outside the mathmatics class with a constructor that initialises everything in the initialiser list. Not exactly my first choice but hey, im not sure if i can do it the way i want to.


Am i really that different to other programmers (in a bad way)? Seems like, every piece of code i post, it seems to puzzle people lol.
Quote:Original post by Reegan
Ah well thats just personal preferance, i prefer the dot operator to the scope resolution operator.

Use C# or Java, then. In the long run that's a terrible reason to go out of your way for. =/

Quote:Original post by Reegan
At the moment ive defined a PI struct outside the mathmatics class with a constructor that initialises everything in the initialiser list. Not exactly my first choice but hey, im not sure if i can do it the way i want to.


Well, at least you have it in a namespace, but that's going out of your way for something that doesn't help you in the long run. Is the :: operator that ugly to you? The makers of PHP liked it enough to gave it its own name - Paamayim Nekudotayim! [grin]

~Jonathan
I do plan on using C# (allthough i do think C# uses an excessive amount of keywords which is kinda ugly) at some point, but the glamour of C++ and its infamous status won me over lol

Like i said, i dont expect people to understand my coding style, if it is wrong i think its just best to let me make my own mistakes, dont you? It means ill actually be learning rather than just taking peoples word for it. however that doesnt mean i dont want help from you or any other programmer at these forums.

PS: We seem to talk alot you and i on here, perhaps i should take your IM email address eh? lol. By the way, are you working on or have finished any games recently? i feel like playing something. [smile]
Quote:Original post by Reegan
I do plan on using C# (allthough i do think C# uses an excessive amount of keywords which is kinda ugly) at some point, but the glamour of C++ and its infamous status won me over lol

Fair enough. It's all in how you use the language, though. I actually find C# to be more well designed than C++. We're each entitled to our opinions [smile]

Quote:Original post by Reegan
Like i said, i dont expect people to understand my coding style, if it is wrong i think its just best to let me make my own mistakes, dont you? It means ill actually be learning rather than just taking peoples word for it. however that doesnt mean i dont want help from you or any other programmer at these forums.

True, but there's a reason we generally tell people to use C++ rather than C: bad habits are often carried over, and they become hard to break. I can empathize with your point of view though. [grin] Anyways, you did ask on the forums, so we're helping as best we can.

Quote:Original post by Reegan
PS: We seem to talk alot you and i on here, perhaps i should take your IM email address eh? lol. By the way, are you working on or have finished any games recently? i feel like playing something. [smile]


Well, my current project doesn't have any kind of demo right now. I want to at least get the collision done, so people can run around my awesome randomly-generated mazes. [lol] As for something playable, check out EasilyConfused's journal - his Squishy demo is great fun.

You can always poke me in a forum PM if you want, I check in pretty often. [smile]
~Jonathan

This topic is closed to new replies.

Advertisement