Thread: How to declare an attribute in MS Visual C++

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    1

    How to declare an attribute in MS Visual C++

    Dear Members,

    I have just started on the tutorial 'Visual C++ in 24 hours'. However, I'm stuck in chapter 11, where the book instructs to 'declare two new variables in the attributes part of the declaration of the Class CDCTestview'. The file DCDTestdoc, however, does not contain any 'attributes' but instead declarations of 'public and protected' variables. I have instead inserted the text:

    //Attributes
    private:
    CMap < int, int, CString, CString > m_map;
    int m_nMapMode;

    in several places that seemed obvious, but the program crashes and announces that m_map and nMapMode are undeclared. Can anyone tell me where to declare these variables?

    Arjan de Bruijn

  2. #2
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Put them in a public section. otherwise they are not visible from CDCTestview. Or make CDCTestview a friend of CDCTestdoc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  2. Functions in C
    By shoobsie in forum C Programming
    Replies: 15
    Last Post: 11-17-2005, 01:47 PM
  3. What's wrong with this code??
    By Xanth in forum C Programming
    Replies: 11
    Last Post: 12-23-2004, 02:41 PM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. MS Visual C++ 6 wont include vector.h in a header file
    By bardsley99 in forum C++ Programming
    Replies: 9
    Last Post: 11-06-2003, 12:05 PM