pghsteelers
Technical User
New to C++ I was curious to know why when using Visual Studio 6, and when in the .cpp class definition file, I used the wizard to add a "member function".
This then created in the .h file my skeleton of the definition for this member function declaration. However, my question is, why can I switch from the declaration in the .cpp file to the definition in the .h file using the magic wand, but if I try to switch back to the declaration using the magic wand, it tells me that it is unable to find the declaration for this function.
The thing is that C++ generated the definitions - more so, I thought that maybe I needed to finish putting in the body of the function in the definition, but after doing so, it still didn't make a difference. Below is the declaration and the definition:
Box.h:
CBox operator+(const CBox& aBox) const;
Box.cpp
CBox CBox:perator +(const CBox &aBox) const
{
return CBox(m_Length > aBox.m_Length? m_Length:aBox.m_Length,
m_Breadth > aBox.m_Breadth? m_Length:aBox.m_Breadth,
m_Height + aBox.m_Height);
}
Any answer to why?
This then created in the .h file my skeleton of the definition for this member function declaration. However, my question is, why can I switch from the declaration in the .cpp file to the definition in the .h file using the magic wand, but if I try to switch back to the declaration using the magic wand, it tells me that it is unable to find the declaration for this function.
The thing is that C++ generated the definitions - more so, I thought that maybe I needed to finish putting in the body of the function in the definition, but after doing so, it still didn't make a difference. Below is the declaration and the definition:
Box.h:
CBox operator+(const CBox& aBox) const;
Box.cpp
CBox CBox:perator +(const CBox &aBox) const
{
return CBox(m_Length > aBox.m_Length? m_Length:aBox.m_Length,
m_Breadth > aBox.m_Breadth? m_Length:aBox.m_Breadth,
m_Height + aBox.m_Height);
}
Any answer to why?