Results 1 to 4 of 4

Thread: Array size definition within class definition

  1. #1
    Join Date
    Jan 2005
    Posts
    498
    Rep Power
    0

    Question Array size definition within class definition

    Ok so i am trying to create an array in my class but i dont want to specify the size as it changes from object to object what i have is this:

    Code:
    class parklot{
    
    private:
    	char lotname;
    	int size, numcars;
    	log currlog[50], permlog[200]; //error here
    
    public:
    	//Constructor
    	parklot(char='Z',int=0,int=0,log=log(),log=log());//default
    	parklot(const parklot &a_parklot);//copy
    
    .......};
    but i get two errors related to that piece of code, these are:
    1. error C2327: 'parklot::size' : is not a type name, static, or enumerator
    2. error C2065: 'size' : undeclared identifier


    can anyone tell me why? is this even possible to begin with?
    Notorios
    That Which Is Not Defined Is Infinitely Great
    Google The Search Engine Of The Gods

  2. #2
    Join Date
    Feb 2005
    Posts
    3,450
    Rep Power
    0

    Default

    We'd probably have to see the necessary portions of your .cpp
    Did you declare the size anywhere else? I think Vylle was still on the same issue as well.
    HTML Code:
    PM or link me                              Smartphone: Samsung Galaxy Note 8 SM-N950F
    CompTIA A+ Certified                       Laptop: Apple MacBook™ Pro
    ITIL v3  Certified                         Tablet: DELL Venue 11 Pro
                 Apple is still the best  thing since sliced bread

  3. #3
    Join Date
    Jan 2005
    Posts
    498
    Rep Power
    0

    Default

    silly me just realized this can be easily worked around using a dynamic array, so i will try that and see what happens
    Notorios
    That Which Is Not Defined Is Infinitely Great
    Google The Search Engine Of The Gods

  4. #4
    Join Date
    Feb 2005
    Posts
    3,450
    Rep Power
    0

    Default

    Didn't you state thiis in your original post before?
    HTML Code:
    PM or link me                              Smartphone: Samsung Galaxy Note 8 SM-N950F
    CompTIA A+ Certified                       Laptop: Apple MacBook™ Pro
    ITIL v3  Certified                         Tablet: DELL Venue 11 Pro
                 Apple is still the best  thing since sliced bread

Posting Permissions

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