473,406 Members | 2,217 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,406 software developers and data experts.

calling Parametrised construtor with less number of arguments

Actually at some place I am creating object of outcome class.

its taking five argument.

i don't want to give 3 and 4 th argument.

i want to give 1,2 and 5 th argument.

Outcome ot(0,MW_MESSAGE, , ,this);\

previously it was written like this

Outcome ot(0,MW_MESSAGE);

working fine

now situation come i need to give it a handle of parent window so i
need to pass this there.

base condtion is that I don't want to change the architure of
Constructor.

it should be as like as it was.



Outcome:utcome( int retVal, SeverityIndex sevIndex, UINT
uTitleStrID,DWORD dwHelpID, CWnd* pParentWnd/* = NULL*/)
{
m_retVal = retVal;
m_SevIndex = sevIndex;

m_uTitleStrID = uTitleStrID;

// test if it is a valid string id
if( m_uTitleStrID )
{
//MWResourceLoader resLoad;
CString strTitle;
BOOL bValid = strTitle.LoadString(m_uTitleStrID);
ASSERT(bValid);
}

// Set the Help ID
m_dwHelpID = dwHelpID;
m_bChangeMessageBoxButtonLabels = FALSE;
m_pParentWnd = pParentWnd;
}

Apr 27 '07 #1
3 1492
On 27 Apr, 11:25, saxenavaibha...@gmail.com wrote:
Actually at some place I am creating object of outcome class.

its taking five argument.

i don't want to give 3 and 4 th argument.

i want to give 1,2 and 5 th argument.
You can either reorder the arguments in the constructor so that the
currently 5th parameter becomes the third, or you can can make a new
constructor taking only the three parameters you are interested in.
Outcome:Outcome( int retVal, SeverityIndex sevIndex, UINT
uTitleStrID,DWORD dwHelpID, CWnd* pParentWnd/* = NULL*/)
By the way, this is not the real constructor is it, because this one
can't be called with just two arguments.

--
Erik Wikström

Apr 27 '07 #2
On Apr 27, 2:34 pm, Erik Wikström <eri...@student.chalmers.sewrote:
On 27 Apr, 11:25, saxenavaibha...@gmail.com wrote:
Actually at some place I am creating object of outcome class.
its taking five argument.
i don't want to give 3 and 4 th argument.
i want to give 1,2 and 5 th argument.

You can either reorder the arguments in the constructor so that the
currently 5th parameter becomes the third, or you can can make a new
constructor taking only the three parameters you are interested in.
Outcome:Outcome( int retVal, SeverityIndex sevIndex, UINT
uTitleStrID,DWORD dwHelpID, CWnd* pParentWnd/* = NULL*/)

By the way, this is not the real constructor is it, because this one
can't be called with just two arguments.

--
Erik Wikström
hi erik u r rite absolutely but the problem is I can't change
defination of constructor due to some reason.
default value of these parmaeter is defined in the delaration of
construtor
thatswhy it was called previously when I pass only two value while
creating object
well Thanks a lot for ur help

Apr 27 '07 #3
On 27 Apr, 12:19, saxenavaibha...@gmail.com wrote:
On Apr 27, 2:34 pm, Erik Wikström <eri...@student.chalmers.sewrote:
On 27 Apr, 11:25, saxenavaibha...@gmail.com wrote:
Actually at some place I am creating object of outcome class.
its taking five argument.
i don't want to give 3 and 4 th argument.
i want to give 1,2 and 5 th argument.
You can either reorder the arguments in the constructor so that the
currently 5th parameter becomes the third, or you can can make a new
constructor taking only the three parameters you are interested in.
Outcome:Outcome( int retVal, SeverityIndex sevIndex, UINT
uTitleStrID,DWORD dwHelpID, CWnd* pParentWnd/* = NULL*/)
By the way, this is not the real constructor is it, because this one
can't be called with just two arguments.
--
Erik Wikström

hi erik u r rite absolutely but the problem is I can't change
defination of constructor due to some reason.
default value of these parmaeter is defined in the delaration of
construtor
thatswhy it was called previously when I pass only two value while
creating object
As I said, you can always create a new constructor.

--
Erik Wikström

Apr 27 '07 #4

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

Similar topics

3
by: Vince | last post by:
Hi, I'd like to know how to call a DLL function, when the number of argument can be variant. Thanks, Vince
4
by: Gibby Koldenhof | last post by:
Hiya, I'm setting up some code in the spirit of Design Patterns, OOP, etc. All nice and well, it handles pretty much all OO style things and serves my purposes well. There's one last final...
18
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
1
by: C#_Beginner | last post by:
I was wondering if someone can help me out. I'm getting the following error: Message: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GET_RIGHTS2'...
15
by: dspfun | last post by:
Hi, Is it possible to print the function name of the calling function? For example, f1() and f2() both calls f3(), in f3() I would like to print the name of the function calling f3() which...
2
by: sarojjena | last post by:
By default the compiler will provide a copy construtor but we write a copy construtor own.
12
by: tom_kuehnert | last post by:
Hi! I'm trying to execute a program using system(). The program itself is located in some path which might contain whitespaces. Simple solution would be this: system("\"C:\A B\C.exe\""); ...
10
by: sulekhasweety | last post by:
Hi, the following is the definition for calling convention ,which I have seen in a text book, can anyone give a more detailed explanation in terms of ANSI - C "the requirements that a...
6
by: Ole Nielsby | last post by:
VC has a __cdecl specifier which allows functions and methods to be called with varying parameter count. (I understand this is the default for functions in general but in VC, instances use...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.