Click here to Skip to main content
15,881,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questiondll using in VB or VC# Pin
kingday4-Dec-07 7:09
kingday4-Dec-07 7:09 
GeneralRe: dll using in VB or VC# Pin
CPallini4-Dec-07 9:22
mveCPallini4-Dec-07 9:22 
QuestionAlternatives to IExpress? Pin
chaiguy13374-Dec-07 5:44
chaiguy13374-Dec-07 5:44 
QuestionRe: 2D Tree Visualisation Pin
Lea Hayes4-Dec-07 3:14
Lea Hayes4-Dec-07 3:14 
GeneralRe: 2D Tree Visualisation Pin
Matthew Faithfull4-Dec-07 3:42
Matthew Faithfull4-Dec-07 3:42 
GeneralRe: 2D Tree Visualisation Pin
CPallini4-Dec-07 4:53
mveCPallini4-Dec-07 4:53 
GeneralRe: 2D Tree Visualisation Pin
zlike4-Dec-07 5:02
zlike4-Dec-07 5:02 
Generalcompile error about member variable initialization Pin
George_George4-Dec-07 2:49
George_George4-Dec-07 2:49 
Hello everyone,


Why the below code segment will result in compile error? When I change code to the comment one (constructor), it can compile. The compiler is too stupid? Smile | :)

I am using Visual Studio 2005.

--------------------
main.cpp(13) : error C2758: 'Foo::vi' : must be initialized in constructor base/member initializer list

see declaration of 'Foo::vi'
--------------------

#include <vector>

using namespace std;

class Foo {

private:

	vector<int>& vi;

public:

	Foo (vector<int>& vi_in)
	{
		vi = vi_in;
	}
/*
	Foo (vector<int>& vi_in) : vi (vi_in)
	{
	}
*/
};

int main()
{
	vector<int> vi;
	Foo foo = Foo (vi);


	return 0;
}



thanks in advance,
George
GeneralRe: compile error about member variable initialization Pin
CPallini4-Dec-07 3:22
mveCPallini4-Dec-07 3:22 
JokeOff Topic Pin
toxcct4-Dec-07 5:37
toxcct4-Dec-07 5:37 
GeneralRe: Off Topic Pin
CPallini4-Dec-07 6:13
mveCPallini4-Dec-07 6:13 
JokeRe: Off Topic Pin
toxcct4-Dec-07 21:48
toxcct4-Dec-07 21:48 
GeneralRe: compile error about member variable initialization Pin
toxcct4-Dec-07 3:23
toxcct4-Dec-07 3:23 
GeneralRe: compile error about member variable initialization Pin
Matthew Faithfull4-Dec-07 3:33
Matthew Faithfull4-Dec-07 3:33 
Generalenable tool bar button Pin
CJ9420024-Dec-07 2:43
CJ9420024-Dec-07 2:43 
GeneralRe: enable tool bar button Pin
CPallini4-Dec-07 2:56
mveCPallini4-Dec-07 2:56 
GeneralRe: enable tool bar button Pin
Maximilien4-Dec-07 3:03
Maximilien4-Dec-07 3:03 
AnswerRe: enable tool bar button Pin
Paresh Chitte4-Dec-07 18:00
Paresh Chitte4-Dec-07 18:00 
GeneralIn CFormView SDI, change CFormView dynamically, got a problem [modified] Pin
followait4-Dec-07 2:15
followait4-Dec-07 2:15 
GeneralMore accurate Pin
followait4-Dec-07 2:25
followait4-Dec-07 2:25 
GeneralRe: In CFormView SDI, change CFormView dynamically, got a problem Pin
followait4-Dec-07 2:36
followait4-Dec-07 2:36 
GeneralHey YOU !!! :( Pin
toxcct4-Dec-07 2:43
toxcct4-Dec-07 2:43 
GeneralRe: Hey YOU !!! :( Pin
followait4-Dec-07 3:19
followait4-Dec-07 3:19 
GeneralRe: Hey YOU !!! :( Pin
Nelek4-Dec-07 21:50
protectorNelek4-Dec-07 21:50 
Generalintellisense in VC++/C# Pin
sree4-Dec-07 1:47
sree4-Dec-07 1:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.