Click here to Skip to main content
15,888,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Please Help me out on this question? Pin
Richard MacCutchan12-Nov-09 6:24
mveRichard MacCutchan12-Nov-09 6:24 
QuestionHow many counts that the simple C++ code will call the Construction/Destruction ? Pin
wangningyu12-Nov-09 3:04
wangningyu12-Nov-09 3:04 
AnswerRe: How many counts that the simple C++ code will call the Construction/Destruction ? [modified] Pin
Cedric Moonen12-Nov-09 3:12
Cedric Moonen12-Nov-09 3:12 
GeneralRe: Thanks ! Pin
wangningyu12-Nov-09 3:15
wangningyu12-Nov-09 3:15 
GeneralOT- Damn... Pin
CPallini12-Nov-09 3:20
mveCPallini12-Nov-09 3:20 
GeneralRe: OT- Damn... Pin
Cedric Moonen12-Nov-09 3:22
Cedric Moonen12-Nov-09 3:22 
GeneralRe: Pin
wangningyu12-Nov-09 3:31
wangningyu12-Nov-09 3:31 
AnswerRe: How many counts that the simple C++ code will call the Construction/Destruction ? Pin
CPallini12-Nov-09 3:17
mveCPallini12-Nov-09 3:17 
wangningyu wrote:
why is 1 Counstruction and 5 Destruction ?


Because default constructor is not the unique constructor, try:
#include <iostream>
using namespace std;


class A
{
public:
	A()
	{
		cout<<"Construction..."<<endl;
	}
        A(const A & a){cout<<"Copy Construction..."<<endl;}

        A & operator=(const A & a){cout<<"Assignment operator..."<<endl;}
	~A()
	{
		cout<<"Destruction...."<<endl;
	}
};

A foo(A a)
{
	return a;
}

int main(int argc, char* argv[])
{
	A    a;
	foo(a);
	A    b = foo(a);
	return 0;
}


Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

QuestionSetting Properties of a DirectShow source filter (not DMO filter) in code (no GUI) Pin
RobstaHendricks12-Nov-09 2:44
RobstaHendricks12-Nov-09 2:44 
QuestionQueue Class Pin
Max++12-Nov-09 2:39
Max++12-Nov-09 2:39 
AnswerRe: Queue Class Pin
Cedric Moonen12-Nov-09 2:45
Cedric Moonen12-Nov-09 2:45 
QuestionFont size of ComboBox text Pin
m_mun12-Nov-09 2:31
m_mun12-Nov-09 2:31 
QuestionRe: Font size of ComboBox text Pin
David Crow12-Nov-09 5:12
David Crow12-Nov-09 5:12 
QuestionI need a programm in C Hexadecimal to decimal Pin
hapyharra12-Nov-09 1:26
hapyharra12-Nov-09 1:26 
AnswerRe: I need a programm in C Hexadecimal to decimal Pin
Rajesh R Subramanian12-Nov-09 1:29
professionalRajesh R Subramanian12-Nov-09 1:29 
AnswerRe: I need a programm in C Hexadecimal to decimal Pin
mav@octaval12-Nov-09 1:48
mav@octaval12-Nov-09 1:48 
AnswerRe: I need a programm in C Hexadecimal to decimal Pin
CPallini12-Nov-09 2:27
mveCPallini12-Nov-09 2:27 
QuestionBitmap::FromResource(HINSTANCE, WCHAR) , problem Pin
kk_Kevin12-Nov-09 1:14
kk_Kevin12-Nov-09 1:14 
AnswerRe: Bitmap::FromResource(HINSTANCE, WCHAR) , problem Pin
kk_Kevin12-Nov-09 1:33
kk_Kevin12-Nov-09 1:33 
GeneralRe: Bitmap::FromResource(HINSTANCE, WCHAR) , problem Pin
Hadi Dayvary12-Jan-21 5:21
professionalHadi Dayvary12-Jan-21 5:21 
QuestionCFileDialog and Vista + Win7 problem! Pin
Arrin12-Nov-09 1:01
Arrin12-Nov-09 1:01 
AnswerRe: CFileDialog and Vista + Win7 problem! Pin
Maximilien12-Nov-09 2:50
Maximilien12-Nov-09 2:50 
GeneralRe: CFileDialog and Vista + Win7 problem! Pin
Arrin12-Nov-09 3:58
Arrin12-Nov-09 3:58 
GeneralRe: CFileDialog and Vista + Win7 problem! Pin
Arrin12-Nov-09 21:17
Arrin12-Nov-09 21:17 
QuestionCScrollBar() in View Pin
Anu_Bala12-Nov-09 0:07
Anu_Bala12-Nov-09 0:07 

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.