Click here to Skip to main content
15,917,538 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can set the Value of Edit Box? Pin
Yajnesh Narayan Behera11-May-08 22:39
Yajnesh Narayan Behera11-May-08 22:39 
GeneralRe: How can set the Value of Edit Box? Pin
Le@rner11-May-08 23:12
Le@rner11-May-08 23:12 
GeneralRe: How can set the Value of Edit Box? Pin
Yajnesh Narayan Behera12-May-08 1:55
Yajnesh Narayan Behera12-May-08 1:55 
GeneralRe: How can set the Value of Edit Box? Pin
Rajesh R Subramanian12-May-08 0:54
professionalRajesh R Subramanian12-May-08 0:54 
Questionpublic & protect question Pin
followait11-May-08 21:37
followait11-May-08 21:37 
AnswerRe: public & protect question Pin
CPallini11-May-08 21:48
mveCPallini11-May-08 21:48 
GeneralRe: public & protect question Pin
followait11-May-08 22:11
followait11-May-08 22:11 
GeneralRe: public & protect question Pin
CPallini11-May-08 22:31
mveCPallini11-May-08 22:31 
Your code does not compile. Anyway, probably you intended something similar to
#include <iostream>
#include <assert.h>

using namespace std;

class B
{
public:
	B(){v();}
//protected: LINE REMOVED
	virtual ~B() {
    cout<<"~B"<<endl;
	}
	virtual void v(){cout<<"B"<<endl;}
private:
};

class D : public B
{
public:
	D(){v();}
protected:
	~D() {
    cout<<"~D"<<endl;
	};
	virtual void v(){cout<<"D"<<endl;}
private:
};

int main()
{
	B *p=new D;
	delete p;

	return 0;
}

it outputs (maybe surprisingly):
B
D
~D
B

It compiles due to runtime binding. I.e. compiler doesn't know that D destructor will be called.
As someone already pointed out, however, you cannot use the following code
D d;

while
B b;

is legal.

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


GeneralRe: public & protect question Pin
C.P.Rajesh11-May-08 23:21
C.P.Rajesh11-May-08 23:21 
GeneralRe: public & protect question Pin
CPallini11-May-08 23:31
mveCPallini11-May-08 23:31 
GeneralRe: public & protect question Pin
C.P.Rajesh11-May-08 23:39
C.P.Rajesh11-May-08 23:39 
GeneralRe: public & protect question Pin
CPallini11-May-08 23:55
mveCPallini11-May-08 23:55 
GeneralRe: public & protect question Pin
Rajkumar R11-May-08 23:36
Rajkumar R11-May-08 23:36 
AnswerRe: public & protect question Pin
Naveen11-May-08 21:49
Naveen11-May-08 21:49 
QuestionRe: public & protect question Pin
Rajkumar R11-May-08 21:51
Rajkumar R11-May-08 21:51 
AnswerRe: public & protect question Pin
followait11-May-08 22:19
followait11-May-08 22:19 
GeneralRe: public & protect question Pin
Rajkumar R11-May-08 22:24
Rajkumar R11-May-08 22:24 
QuestionWhich message the Windows sent indication the creation of a new file to Explorer windows Pin
Nitheesh George11-May-08 21:36
Nitheesh George11-May-08 21:36 
AnswerRe: Which message the Windows sent indication the creation of a new file to Explorer windows Pin
Naveen11-May-08 21:45
Naveen11-May-08 21:45 
GeneralRe: Which message the Windows sent indication the creation of a new file to Explorer windows Pin
Nitheesh George11-May-08 22:18
Nitheesh George11-May-08 22:18 
QuestionClass ProtoType Pin
dehseth11-May-08 21:30
dehseth11-May-08 21:30 
QuestionRe: Class ProtoType Pin
CPallini11-May-08 21:41
mveCPallini11-May-08 21:41 
AnswerRe: Class ProtoType Pin
dehseth11-May-08 22:23
dehseth11-May-08 22:23 
GeneralRe: Class ProtoType Pin
CPallini11-May-08 22:50
mveCPallini11-May-08 22:50 
QuestionRe: Class ProtoType Pin
dehseth12-May-08 1:35
dehseth12-May-08 1:35 

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.