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

C / C++ / MFC

 
QuestionC++ - code executed upon definite program termination Pin
liquid_5-Apr-14 20:21
liquid_5-Apr-14 20:21 
AnswerRe: C++ - code executed upon definite program termination Pin
CPallini6-Apr-14 4:59
mveCPallini6-Apr-14 4:59 
AnswerRe: C++ - code executed upon definite program termination Pin
Richard Andrew x646-Apr-14 11:30
professionalRichard Andrew x646-Apr-14 11:30 
AnswerRe: C++ - code executed upon definite program termination Pin
pasztorpisti6-Apr-14 18:39
pasztorpisti6-Apr-14 18:39 
AnswerRe: C++ - code executed upon definite program termination Pin
Heng Xiangzhong7-Apr-14 16:26
Heng Xiangzhong7-Apr-14 16:26 
SuggestionRe: C++ - code executed upon definite program termination Pin
David Crow7-Apr-14 16:43
David Crow7-Apr-14 16:43 
GeneralRe: C++ - code executed upon definite program termination Pin
Heng Xiangzhong7-Apr-14 19:20
Heng Xiangzhong7-Apr-14 19:20 
GeneralRe: C++ - code executed upon definite program termination Pin
CPallini7-Apr-14 23:43
mveCPallini7-Apr-14 23:43 
Heng Xiangzhong wrote:
But the question is how can you control this object is destructed behind the any other one?

You can control it is constructed before main execution (and destructed after main execution) making it global, e.g.
C++
#include <iostream>
using namespace std;

class A
{
public:
  A(){cout << "A ctor" << endl;}
  ~A(){cout << "A dtor" << endl;}
};

A a;

int main()
{
  cout << "main" << endl;
}

Veni, vidi, vici.

GeneralRe: C++ - code executed upon definite program termination Pin
Heng Xiangzhong8-Apr-14 0:27
Heng Xiangzhong8-Apr-14 0:27 
GeneralRe: C++ - code executed upon definite program termination Pin
liquid_8-Apr-14 11:29
liquid_8-Apr-14 11:29 
GeneralRe: C++ - code executed upon definite program termination Pin
Heng Xiangzhong8-Apr-14 15:25
Heng Xiangzhong8-Apr-14 15:25 
QuestionOperator overload question Pin
econy5-Apr-14 13:42
econy5-Apr-14 13:42 
AnswerRe: Operator overload question Pin
Richard Andrew x645-Apr-14 15:18
professionalRichard Andrew x645-Apr-14 15:18 
GeneralRe: Operator overload question Pin
econy7-Apr-14 5:49
econy7-Apr-14 5:49 
GeneralRe: Operator overload question Pin
Richard MacCutchan7-Apr-14 6:04
mveRichard MacCutchan7-Apr-14 6:04 
AnswerRe: Operator overload question Pin
CPallini7-Apr-14 2:28
mveCPallini7-Apr-14 2:28 
GeneralRe: Operator overload question Pin
econy7-Apr-14 5:51
econy7-Apr-14 5:51 
GeneralRe: Operator overload question Pin
CPallini7-Apr-14 6:21
mveCPallini7-Apr-14 6:21 
QuestionReference variable assignment and copy constructor call Pin
trinh.nguyen4-Apr-14 19:05
trinh.nguyen4-Apr-14 19:05 
AnswerRe: Reference variable assignment and copy constructor call Pin
Randor 4-Apr-14 21:47
professional Randor 4-Apr-14 21:47 
GeneralRe: Reference variable assignment and copy constructor call Pin
trinh.nguyen4-Apr-14 23:10
trinh.nguyen4-Apr-14 23:10 
GeneralRe: Reference variable assignment and copy constructor call Pin
Randor 4-Apr-14 23:57
professional Randor 4-Apr-14 23:57 
QuestionSoftware USB write blocker for linux Pin
dream qq4-Apr-14 13:32
dream qq4-Apr-14 13:32 
QuestionHow to change tab event of property sheet Pin
kangte22223-Apr-14 15:15
kangte22223-Apr-14 15:15 
QuestionRe: How to change tab event of property sheet Pin
David Crow3-Apr-14 16:43
David Crow3-Apr-14 16:43 

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.