• Advertisement

Smack0007

Member
  • Content count

    82
  • Joined

  • Last visited

Community Reputation

157 Neutral

About Smack0007

  • Rank
    Member
  1. My point is this. You see alot of people do this: class CFoo { private: int m_x, m_y; public: int GetX() { return m_x; } void SetX(int x) { m_x = x; } int GetY() { return m_y; } void SetY(int y) { m_y = y; } }; There is no added benefit to this, but that is the whole idea behind information hiding, blah blah blah. The guy asked if there was anything equivlent to properties in C++ or Java. I said no. Then I offered something similar.
  2. There is no real benefit. It just makes code look readable. I was refering to C++ code, read the post before mine.
  3. This is true but I like to do things like: class CFoo { private: int m_x, m_y; public: int& X() { return m_x; } int& Y() { return m_y; } }; So then I can do things like: CFoo foo; foo.X() = 10; foo.Y() = 20; cout<<foo.X(); cout<<foo.Y(); You would only want to do this with member variables that can be edited freely.
  4. Use the first method. Properties are pretty standard throughout C#.
  5. Link Check out the third result.
  6. Memory allocation

    You might want to look into using the std::vector class. Link
  7. Circular Includes

    Basically this is how it should work out: // CEnemy.h class COtherClass; class CEnemy { public: void DoSomething() { ... } void DoSomethingElse(COhterClass& oc); } // COtherClass.h class CEnemy; class COtherClass { public: void DoSomething() { ... } void DoSomethingElse(CEnemy& enemy); } // CEnemy.cpp #include "CEnemy.h" #include "COtherClass.h" void CEnemy::DoSomethingElse(COtherClass& oc) { oc.DoSomething(); } // COtherClass.cpp #include "COhterClass.h" #include "CEnemy.h" void COtherClass::DoSomethingElse(CEnemy& enemy) { enemy.DoSomething(); } This way, both classes are defined before you try and use them. I'm pretty sure this is the only real workaround. If anyone knows any tricks, I would love to be corrected.
  8. Circular Includes

    I'm guessing in enemy.h you have your class implementation and definition all together? If so, what you need to do is keep things the way you have them, but seperate the definations into .cpp files. Now, you can either completely seperate all definitions into .cpp files or you can just take the definitions of functions that need to access members of the other class into seperate .cpp files. Tell me if this is unclear and I'll give a better example.
  9. I like the no title bar idea better than my original idea. That way you couldn't drag it period.
  10. I think WM_MOVE is sent after the Window has been moved.
  11. Windows send a WM_MOVE message when they are moved. Just move the window to the deisred position whenever it gets moved.
  12. Open/Save dialogs and color chooser

    Start here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary.asp
  13. inline methods in VC++

    You might try taking out the second inline. void CWhatever::DoSomething() Don't know if that will fix it.
  14. You could just use: std::vector< std::vector<float> > myVec; That would give you a multidimentional array.
  • Advertisement