Questions tagged [reference-parameters]

11 questions
72
votes
9 answers

C# property and ref parameter, why no sugar?

I just ran across this error message while working in C# A property or indexer may not be passed as an out or ref parameter I known what caused this and did the quick solution of creating a local variable of the correct type, calling the function…
BCS
  • 75,627
  • 68
  • 187
  • 294
57
votes
8 answers

How do I use Reference Parameters in C++?

I am trying to understand how to use reference parameters. There are several examples in my text, however they are too complicated for me to understand why and how to use them. How and why would you want to use a reference? What would happen if you…
Sagistic
  • 683
  • 2
  • 9
  • 16
8
votes
3 answers

Why can't I retrieve the value for parameters of type out or ref using Type.InvokeMember?

A long title, but I wanted it to be specific. The title is really the question. Even though the method that InvokeMember is calling has an out parameter and is assigning a value to to that parameter I can't grab that value. Here is the code I was…
Greener
  • 1,327
  • 3
  • 13
  • 19
2
votes
5 answers

Difficulties with string declaration/reference parameters (c++)

Last week I got an homework to write a function: the function gets a string and a char value and should divide the string in two parts, before and after the first occurrence of the existing char. The code worked but my teacher told me to do it…
Albay
  • 21
  • 2
2
votes
2 answers

Initializing objects on the fly

I have a vector called players and a class called Player. And what I'm trying to do is to write: players.push_back(Player(name, Weapon(bullets))); So I want to be able to create players in a loop. But I see an error message says "no matching…
pocoa
  • 4,197
  • 9
  • 37
  • 45
1
vote
0 answers

Return a number as reference parameter

I am a freshman college student learning C++. I want to return the number as a reference parameter in a template function. Btwhen I debug, nothing appears there. Please help the rookie! #include using namespace std; template T…
Richard
  • 11
  • 1
1
vote
1 answer

Method Overriding with reference passed as argument

This question is based on the concept that when I store the reference of child class into parents class variable.And, using that variable I call the method that is present in both the classes Child-Parent.Here child method should get evoked and it…
1
vote
1 answer

How to add wsa reference parameters to cxf client call?

I understand how to simply add the "standard" ws addressing headers to a cxf client call: JaxWsProxyFactoryBean factory = ...; factory.getFeatures().add(new WSAddressingFeature()); But I don't understand exactly how I could add wsa reference…
soilworker
  • 1,317
  • 1
  • 15
  • 32
0
votes
2 answers

Is this reference to ostream a local variable

in c++primer 5th edition p393 it is written : The variables captured by a lambda are local variables The book then shows an ostream as a referenced parameter, captured by reference by the lambda. This is similar : #include using…
user
  • 934
  • 6
  • 17
0
votes
0 answers

Reference Parameters Address Automatically NOT passed

I have the following issue with reference parameters: When we have a function with reference parameters, the compiler will automatically pass to that function, the address of any argument it is called with. Example (with object): class sample { char…
Creator
  • 21
  • 1
  • 6
-4
votes
2 answers

Use of Undeclared Identifier "angle"?

I am making a program that converts rectangular coordinates into polar coordinates and whenever I go to run the program it tells me that the "angle" is undeclared even though I am sure I have declared it. As well I know that the program isn't…
Jacob Culp
  • 27
  • 3