Results 1 to 5 of 5

Thread: I hate classes!

  1. #1
    wossname
    Guest

    I hate classes!

    Code:
    typedef unsigned long integer ULI;
    
    class SecureHA
    {
     private:
    
     ULI H[5]={23,54,27,45,64};   //ERROR HERE!
    ...
    ...
    ...
    }:
    The compiler will not let me initialise this array within the class definition, any ideas why?

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    You cannot initialize data members like this. It must be in the constructor.
    Code:
    class c
    {
    private:
    	int h[5];
    
    public:
    	c()
    	{
    		h[0] = 23;
    		h[1] = 54;
    		h[2] = 27;
    		h[3] = 45;
    		h[4] = 64;
    	}
    };
    Enjoy

  3. #3
    wossname
    Guest
    Cool thanks.

    Hmm, I don't suppose you know how to read a file into an array of unsigned long integers do you?
    The array size is a multiple of 512 bytes. But the file is probably a bit less than that (but the array will always be big enough to hold the file).
    Its a weird request from a C++ newbiw like me, but I gotta start somewhere!



  4. #4
    denniswrenn
    Guest
    How are you going to store the information in the unsigned long integers? Is it going to be the ASCII value?

  5. #5
    wossname
    Guest
    Once its in the array and has been processed, it will be in a completely incoherent form. Except no-one knows how to get it in there!

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