User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 401,653 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,692 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 2728 | Replies: 2
Reply
Join Date: Dec 2004
Posts: 1
Reputation: rporter1 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rporter1 rporter1 is offline Offline
Newbie Poster

Help Initializing an array as a class mamber

  #1  
Dec 2nd, 2004
I have found out through the compiler that you cannot declare and initialize an array within a class header file. I was trying to figure out how I might go about getting a 5 by 14 array initialized as a private mamber within the class. I have included the header file and the class cpp file, neither are in full working form, but you should be able to get the idea about what i am trying to accomplish. thanks for taking a look.
Attached Files
File Type: h vend.h (1.3 KB, 13 views)
File Type: cpp vend.cpp (3.7 KB, 6 views)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Location: In BHavnagar(Gujarat-India)
Posts: 11
Reputation: achyut is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
achyut achyut is offline Offline
Newbie Poster

Re: Initializing an array as a class mamber

  #2  
Feb 22nd, 2005
you cannot declare and initialize an array in header file.but u can crate as many as u want object of any class member in your .c++ file so using this u can create run time array. think on this
Reply With Quote  
Join Date: Feb 2005
Location: 55 26'N 118 46'W
Posts: 181
Reputation: Tight_Coder_Ex is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 13
Tight_Coder_Ex's Avatar
Tight_Coder_Ex Tight_Coder_Ex is offline Offline
Junior Poster

Re: Initializing an array as a class mamber

  #3  
Feb 22nd, 2005
All you have to do is move or more specifically code appropriately in Vend::Vend (default constructor) the values you want in fasm. This is how variables are initialized in a class, like int value [1][2] = {4, 8}; would be too code.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 6:54 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC