473,396 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Passing array argument to constructor

Hi, I have a problem with the following code, which doesn't compile on
the MSVC8 compiler.

CReportScreen derives from CDialog // although this probably has
nothing to do with it
HBITMAP is a typedef for an int

CReportScreen(CWnd* pParent = NULL, HBITMAP bmpArray[3]);

CReportScreen::CReportScreen(CWnd* pParent , HBITMAP bmpArray[3])
: CDialog(CReportScreen::IDD, pParent),

{
}

then i instantiate the CReportScreen as follows :

CReportScreen reportDlg(NULL, m_hLogoBmpArray);

where m_hLogoBmpArray is declared as HBITMAP m_hLogoBmpArray [3]
I'm getting the following compile error

error C2548: 'CReportScreen::CReportScreen' : missing default
parameter for parameter 2
in the header file declaration
CReportScreen(CWnd* pParent = NULL, HBITMAP bmpArray[3]);
Thanks
Nov 27 '07 #1
1 3030
dev_15 wrote:
Hi, I have a problem with the following code, which doesn't compile on
the MSVC8 compiler.

CReportScreen derives from CDialog // although this probably has
nothing to do with it
HBITMAP is a typedef for an int

CReportScreen(CWnd* pParent = NULL, HBITMAP bmpArray[3]);
This declaration is not valid: All parameter declarations that follow a
parameter with a default value must have a default value, too. In your case you
would have to either A) remove the default parameter from parameter pParent or
B) add a default parameter to bmpArray. Option B cannot be used as the bitmap
array is certainly essential to the construction of CReportScreen objects.

I posted the rest of the answer to microsoft.public.vc.mfc, as this would be OT
here.

Regards,
Stuart
Nov 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Alex Vinokur | last post by:
Various forms of argument passing ================================= C/C++ Performance Tests ======================= Using C/C++ Program Perfometer...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
25
by: Victor Bazarov | last post by:
In the project I'm maintaining I've seen two distinct techniques used for returning an object from a function. One is AType function(AType const& arg) { AType retval(arg); // or default...
3
by: Tim Wallace | last post by:
I have an array of bytes I read from a TcpClient. I need to pass that byte array in to the constructor of an object. My code compiles, but when run, I get a message stating: ...
3
by: Steve | last post by:
Hello, I created a public Structure in a Standard Module and also an array of Structures. Then I load data into the array of structures in a public sub that I call on the Form load event. ...
6
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an...
12
by: dave_dp | last post by:
Hi, I have just started learning C++ language.. I've read much even tried to understand the way standard says but still can't get the grasp of that concept. When parameters are passed/returned...
3
by: tfoulsh | last post by:
Hi, I'm sure this is a relatively simple question but I can't work out the syntax for what I want to do. I have a class whose constructor takes a single argument. If I declare an array of this...
5
by: nass | last post by:
this is a thought experiment. i do not have the time to implement it and test it to see if it works so i am relying on your good will:) thank you in advance im on a linux machine (slackware...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.