Connecting Tech Pros Worldwide Help | Site Map

need help with constructor

Member
 
Join Date: Oct 2009
Posts: 33
#1: Oct 6 '09
hello there.
here's the problem.

Expand|Select|Wrap|Line Numbers
  1.  
  2. //given 2 constructor
  3.  
  4. vector v1;
  5. vector v2(parameter);
  6.  
  7. //member function 
  8. n= intdotProduct(const Vector &x)
  9.  
  10. //in the test code it is given as
  11. n=v1.dotProduct(v2);
  12.  
  13.  
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

Expand|Select|Wrap|Line Numbers
  1. 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
Familiar Sight
 
Join Date: Jan 2007
Posts: 186
#2: Oct 6 '09

re: need help with constructor


The first constructor v1 needs parenthesis. i.e. v1();
Just call v1() with out any parameters.
Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,148
#3: Oct 6 '09

re: need help with constructor


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::getNumColumns

i.e. the parentheses () are missing.
Reply