"Defused" <De*****@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
i have a file named CDSEncoder.cpp, and i wanted to create a member
variable of this in KNNDlg.cpp...so i wrote the following under my KNNDlg.h file
protected:
CDSEncoder m_encoder;
but there showed..
c:\Documents and Settings\MVP\Desktop\KNN\KNNDlg.h(25): error C2146:
syntax error : missing ';' before identifier 'm_encoder'
so my qns is how do i create a member variable of CDSEncoder?? Did i
miss out any steps or have i did the wrong thing?
OK, CDSEncoder is your class name, correct?
And, you wish to add a protected member variable to your class definition
using the name m_encoder?
If I'm guessing right so far, you're actually attempting to instantiate an
object of type CDSEncoder before finishing the class definition, thus the
compiler is complaining that it has not yet detected the end of the class
definition (denoted by a ; following a }).
Basically, AFAIK (and I'm confident I'll be corrected if I'm wrong) you
cannot create an object of the class being defined as a member variable of
that class.
--
Peter [MVP Visual Developer]
Jack of all trades, master of none.