Click here to Skip to main content
15,844,156 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questiondll using in VB or VC# Pin
kingday4-Dec-07 8:09
kingday4-Dec-07 8:09 
GeneralRe: dll using in VB or VC# Pin
CPallini4-Dec-07 10:22
mveCPallini4-Dec-07 10:22 
QuestionAlternatives to IExpress? Pin
chaiguy13374-Dec-07 6:44
chaiguy13374-Dec-07 6:44 
QuestionRe: 2D Tree Visualisation Pin
Lea Hayes4-Dec-07 4:14
Lea Hayes4-Dec-07 4:14 
GeneralRe: 2D Tree Visualisation Pin
Matthew Faithfull4-Dec-07 4:42
Matthew Faithfull4-Dec-07 4:42 
GeneralRe: 2D Tree Visualisation Pin
CPallini4-Dec-07 5:53
mveCPallini4-Dec-07 5:53 
GeneralRe: 2D Tree Visualisation Pin
zlike4-Dec-07 6:02
zlike4-Dec-07 6:02 
Generalcompile error about member variable initialization Pin
George_George4-Dec-07 3:49
George_George4-Dec-07 3: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 4:22
mveCPallini4-Dec-07 4:22 
JokeOff Topic Pin
toxcct4-Dec-07 6:37
toxcct4-Dec-07 6:37 
GeneralRe: Off Topic Pin
CPallini4-Dec-07 7:13
mveCPallini4-Dec-07 7:13 
JokeRe: Off Topic Pin
toxcct4-Dec-07 22:48
toxcct4-Dec-07 22:48 
GeneralRe: compile error about member variable initialization Pin
toxcct4-Dec-07 4:23
toxcct4-Dec-07 4:23 
GeneralRe: compile error about member variable initialization Pin
Matthew Faithfull4-Dec-07 4:33
Matthew Faithfull4-Dec-07 4:33 
Generalenable tool bar button Pin
CJ9420024-Dec-07 3:43
CJ9420024-Dec-07 3:43 
GeneralRe: enable tool bar button Pin
CPallini4-Dec-07 3:56
mveCPallini4-Dec-07 3:56 
GeneralRe: enable tool bar button Pin
Maximilien4-Dec-07 4:03
Maximilien4-Dec-07 4:03 
AnswerRe: enable tool bar button Pin
Paresh Chitte4-Dec-07 19:00
Paresh Chitte4-Dec-07 19:00 
GeneralIn CFormView SDI, change CFormView dynamically, got a problem [modified] Pin
followait4-Dec-07 3:15
followait4-Dec-07 3:15 
GeneralMore accurate Pin
followait4-Dec-07 3:25
followait4-Dec-07 3:25 
GeneralRe: In CFormView SDI, change CFormView dynamically, got a problem Pin
followait4-Dec-07 3:36
followait4-Dec-07 3:36 
GeneralHey YOU !!! :( Pin
toxcct4-Dec-07 3:43
toxcct4-Dec-07 3:43 
GeneralRe: Hey YOU !!! :( Pin
followait4-Dec-07 4:19
followait4-Dec-07 4:19 
GeneralRe: Hey YOU !!! :( Pin
Nelek4-Dec-07 22:50
protectorNelek4-Dec-07 22:50 
Generalintellisense in VC++/C# Pin
sree4-Dec-07 2:47
sree4-Dec-07 2: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.