can someone help me wiht a c++ definition

Topplayer

Senior member
Jan 11, 2006
444
0
0
normally i would just try it out and see but i don't have a c++ program on this computer.

1.4)
can you use an expression for a formal parameter or for an actual argument? if so, for which?



thanks in advance
 

DaShen

Lifer
Dec 1, 2000
10,710
1
0
yes you can in C++
When you define a class library, you can overload parameters like (+, -, =, *, /). I think I remember something like that. It has been a long ass time.

**EDIT**

I think it is called operator overloading.

But as the next post says, I am not sure if that is what the question is asking.
 

JDub02

Diamond Member
Sep 27, 2002
6,209
1
0
I saw the topic and thought I'd be useful. Read the question and now I know that I'm not. I guess I've been out of programming for too long. I'm not even sure what it's asking. :confused:
 

Topplayer

Senior member
Jan 11, 2006
444
0
0
i think its asking if it is possible to use a expression in a argument or parameter with out getting a error
 

tfinch2

Lifer
Feb 3, 2004
22,114
1
0
You can use expressions for actual arguments. Actual arguments are supplied by the caller, and are evaluated before being pushed to the stack and entering the function/method.

For example:

int add (int a, int b) //formal parameters
{
return a + b;
}

void main()
{
int i = 20, j = 30, k = 50;
add (i + j, k); //actual parameters
}
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
I'm confused, is it asking if you can do something like this?

if((X+Y)>Z){}

if so than yes, if not then I am confused.