Results 1 to 10 of 10

Thread: Matrix (well sort of) issue [Resolved]

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Posts
    78

    Matrix (well sort of) issue [Resolved]

    PHP Code:
        #define matrix Matrix

        
    template <class Object>
            class 
    matrix
            
    {    
                public:
                    
    matrixint rowsint cols )
                    {
                        
    vOuter.resize(rows);
                        for(
    int i 0rowsi++)
                            
    vOuter[i].resize(cols);
                        
    NumOfRows rows;
                        
    NumOfCols cols;
                    }
                    
                    
    matrix( const matrix &rhs)
                    {
                        
    vOuter(rhs.vOuter)
                    }

                    const 
    vOuter<object> &operator[] (int row) const
                    {
                        return 
    vOuter[row];
                    }

                    
    vector<Object> &operator[] (int row)
                    {
                        return 
    vOuter[row];
                    }

                    
    int NumRows() 
                    {
                        return 
    NumOfRows;
                    }

                    
    int NumCols()
                    {
                        return 
    NumOfCols;
                    }

                private:
                    
    vectorvector<Object> > vOuter;
                    
    int NumOfRows;
                    
    int NumOfCols;
            }; 
    when trying to call the NumCols and NumRows functions I get these error:
    MatrixTest.cpp(15) : error C2039: 'NumRows' : is not a member of 'Matrix<int>'
    MatrixTest.cpp(16) : error C2039: 'NumCols' : is not a member of 'Matrix<int>'

    I can't seem to figure out what I screwed up...
    Last edited by Balron; Jul 10th, 2003 at 09:04 PM.
    - Your Local Drunk
    AIM: Asharlin
    YIM: Asharlin
    MSN: [email protected]
    ICQ: 177568857

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