CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Feb 2012
    Posts
    19

    Serious lack of OOP understanding. Dependencies in classes.

    Hi
    i have two classes. CHand1326 and CHand169. In both of them i make use of an object of each other. But somehow this produces following error:
    Code:
    1>c: ...\Hand1326.h(23): error C2061: Syntaxfehler: Bezeichner 'CHand169'
    1>c: ...\Hand169.h(22): error C2065: 'CHand1326': nichtdeklarierter Bezeichner
    meaning syntax error with CHand169 an that CHand1326 is not declared. I tried a lot of stuff ... reducing or removing consts added default constructor even assingment operator and copyconstructor. But nothing helps. Please help me! I guess I can't see the forest for the trees...

    Specific hand:
    Code:
    #ifndef CHAND1326_H
    #define CHAND1326_H
    
    #include <stdlib.h>
    #include <Windows.h>
    #include "poker_defs.h"
    #include "Hand169.h"
    
    class CHand1326{
    
    public:
      CHand1326(){};
      CHand1326(const char Rank1, const char Rank2, const char Suit1, const char Suit2);
      
      bool      operator< (CHand1326 rPar) const;
      bool      operator> (CHand1326 rPar) const;
      bool      operator<=(CHand1326 rPar) const;
      bool      operator>=(CHand1326 rPar) const;
      bool      operator==(CHand1326 rPar) const;
      bool      isSuited() const { return mSuit1 == mSuit2;};
      bool      isPair()   const { return mRank1 == mRank2;};
      CardMask  GetCardMask() const;
      void      To169(CHand169 *ret) const;
    
      char mRank1, mRank2, mSuit1, mSuit2;
    };
    #endif // CHAND1326_H
    Handcategory
    Code:
    #ifndef __CHAND169_H
    #define __CHAND169_H
    
    #include <stdlib.h>
    #include <Windows.h>
    #include <set>
    using std::set;
    #include "Hand1326.h"
    
    class CHand169{
    
    public:
      CHand169(){};
      CHand169(const char Rank1, const char Rank2, const bool isSuited); 
      
      const bool operator<    (CHand169 rPar) const;
      const bool operator>    (CHand169 rPar) const;
      const bool operator<=   (CHand169 rPar) const;
      const bool operator>=   (CHand169 rPar) const;
      const bool operator==   (CHand169 rPar) const;
      const bool isPair       ()const {return mRank1 == mRank2;}
      const int  ToCHand1326  (set<CHand1326 >& rHands1326) const;
    
      char mRank1, mRank2;
      bool isSuited;
    
    };
    
    #endif // __CHAND169_H
    Last edited by ImNotaBot; June 11th, 2012 at 03:18 PM. Reason: Forgot title

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured