Results 1 to 3 of 3

Thread: Compile Problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Location
    England
    Posts
    94

    Compile Problem

    Hey Guys

    When i try and compile my program which i have basically just set a class for file acess up in i get this compile error any ideas.

    dwShareMode is defined as a DWORD under private in my class
    'dwShareMode' : pure specifier can only be specified for functions

    Thanks
    Peter
    "Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
    -- Judas Priest

    My email is [email protected]

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    =0 in the end of a function declaration means it's pure virtual, however i thin you are just trying to initialize a variable in the wrong place. There is a specific function called constructor with the same name as the class where you initialize all variable needed to initialize
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Zaei
    Guest
    As kedaman sorta said, you cannot initialize variables in a class as you would in a function.

    Code:
    class myClass
    {
    public:
       myClass();
    
    protected:
       DWORD someVar = 0; // This is incorrect;
    };
    
    class myClass
    {
    public:
       myClass();
    
    protected:
       DWORD someVar; //Correct
    };
    
    myClass::myClass()
    {
       someVar = 0; 
    }
    Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width