473,791 Members | 2,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,DWO RD dwHelpID, CWnd* pParentWnd/* = NULL*/)
{
m_retVal = retVal;
m_SevIndex = sevIndex;

m_uTitleStrID = uTitleStrID;

// test if it is a valid string id
if( m_uTitleStrID )
{
//MWResourceLoade r resLoad;
CString strTitle;
BOOL bValid = strTitle.LoadSt ring(m_uTitleSt rID);
ASSERT(bValid);
}

// Set the Help ID
m_dwHelpID = dwHelpID;
m_bChangeMessag eBoxButtonLabel s = FALSE;
m_pParentWnd = pParentWnd;
}

Apr 27 '07 #1
3 1505
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,DWO RD 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.sewro te:
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,DWO RD 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.sewro te:
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,DWO RD 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
2164
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
1740
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 question remaining: How to properly, simple and eleganty implement functions. The functions are encapsulated in the objects, the objects themselves are stored in a binary tree and objects contain 'methods' (functions) along with data. I don't want to...
18
4360
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 can use dlopen/whatever to convert the function name into a pointer to that function, but actually calling it, with the right number of parameters, isn't easy. As far as I can see, there are only two solutions: 1) This one is portable. If...
1
4834
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' ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GET_RIGHTS2' ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GET_RIGHTS2' ORA-06550: line 1, column 7: PLS-00306: wrong number...
15
22868
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 could either be f1() or f2(). BRs!
2
2336
by: sarojjena | last post by:
By default the compiler will provide a copy construtor but we write a copy construtor own.
12
3490
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\""); but now this program also has parameters which need to be passed (again with paths containing whitepaces)
10
3266
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 programming system places on how a procedure is called and how data is passed between a calling program and procedures are called calling conventions"
6
11582
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 another convention unless they have an ellipsis argument.) I can force GCC and other compilers to use such a convention by declaring all methods with an ellipsis, but I'd rather not clutter my method definitions with these.
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5431
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.