need help with constructor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hanna88
    New Member
    • Oct 2009
    • 33

    need help with constructor

    hello there.
    here's the problem.

    Code:
    //given 2 constructor
    
    vector v1;
    vector v2(parameter);
    
    //member function 
    n= intdotProduct(const Vector &x)
    
    //in the test code it is given as
    n=v1.dotProduct(v2);
    i understand that x is refering to v2 in this case.
    what about v1? how can i acces it? i tried using

    this->somefunction to indicate this == v1 but come out with error

    Code:
    Error error C3867: 'Vector::getNumColumns': function call missing argument list; use '&Vector::getNumColumns' to create a pointer to member
    any help would be much appreciated
  • whodgson
    Contributor
    • Jan 2007
    • 542

    #2
    The first constructor v1 needs parenthesis. i.e. v1();
    Just call v1() with out any parameters.

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      I do not believe you have posted the code that the error relates to. It is saying that you have a member function of Vector, getNumColumns and that somewhere in the code there is the construct

      Vector::getNumC olumns

      i.e. the parentheses () are missing.

      Comment

      Working...