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

C / C++ / MFC

 
AnswerRe: fwrite for unicode big endian Pin
Selvam R10-Sep-09 8:53
professionalSelvam R10-Sep-09 8:53 
GeneralRe: fwrite for unicode big endian Pin
Rakesh510-Sep-09 9:08
Rakesh510-Sep-09 9:08 
GeneralRe: fwrite for unicode big endian Pin
Selvam R10-Sep-09 9:34
professionalSelvam R10-Sep-09 9:34 
Questionreturning by reference and polymorphism Pin
paolosh10-Sep-09 8:11
paolosh10-Sep-09 8:11 
AnswerRe: returning by reference and polymorphism Pin
paolosh10-Sep-09 9:46
paolosh10-Sep-09 9:46 
AnswerRe: returning by reference and polymorphism Pin
Iain Clarke, Warrior Programmer10-Sep-09 9:48
Iain Clarke, Warrior Programmer10-Sep-09 9:48 
AnswerRe: returning by reference and polymorphism Pin
Iain Clarke, Warrior Programmer10-Sep-09 9:49
Iain Clarke, Warrior Programmer10-Sep-09 9:49 
AnswerRe: returning by reference and polymorphism Pin
CPallini10-Sep-09 9:59
mveCPallini10-Sep-09 9:59 
Polymorphism works through pointers, for instance, try:
#include < iostream >
using namespace std;

class B
{
protected:
	int b;
public:
	B(int b){this->b = b;}
	virtual void out(){cout << "hi frm B, data value is " << b << endl;}
};

class D1 : public  B
{
public:
	D1(int i):B(i){}
	virtual void out(){cout << "hi frm D1, data value is " << b << endl;}
};

class D2 : public B
{
public:
	D2(int i):B(i){}
	virtual void out(){cout << "hi frm D2, data value is " << b << endl;}
};

B * myFunc(int i)
{
	switch (i%3)
	{
	case 0:
		return new B(i);
	case 1:
		return new D1(i);
	case 2:
		return new D2(i);
	}
}

void main()
{
	B * p, *q;
	p= myFunc(5);
	q= myFunc(6);
	p->out();
	q->out();
}


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]

GeneralRe: returning by reference and polymorphism Pin
paolosh10-Sep-09 11:35
paolosh10-Sep-09 11:35 
Questiontic tac toe Pin
sam_200910-Sep-09 5:18
sam_200910-Sep-09 5:18 
QuestionRe: tic tac toe Pin
David Crow10-Sep-09 5:20
David Crow10-Sep-09 5:20 
AnswerRe: tic tac toe Pin
PIEBALDconsult10-Sep-09 5:58
mvePIEBALDconsult10-Sep-09 5:58 
AnswerRe: tic tac toe Pin
Keith Barrow10-Sep-09 5:26
professionalKeith Barrow10-Sep-09 5:26 
GeneralRe: tic tac toe Pin
Selvam R10-Sep-09 7:29
professionalSelvam R10-Sep-09 7:29 
AnswerRe: tic tac toe Pin
Richard MacCutchan10-Sep-09 7:34
mveRichard MacCutchan10-Sep-09 7:34 
AnswerWrong forum. Pin
CPallini10-Sep-09 8:31
mveCPallini10-Sep-09 8:31 
GeneralRe: Wrong forum. Pin
EliottA10-Sep-09 8:33
EliottA10-Sep-09 8:33 
AnswerRe: tic tac toe Pin
jinjiashan10-Sep-09 16:49
jinjiashan10-Sep-09 16:49 
QuestionCreating a Time Provider in C++ Pin
bijumanjeri10-Sep-09 5:11
bijumanjeri10-Sep-09 5:11 
AnswerRe: Creating a Time Provider in C++ Pin
David Crow10-Sep-09 5:18
David Crow10-Sep-09 5:18 
GeneralRe: Creating a Time Provider in C++ Pin
bijumanjeri10-Sep-09 5:30
bijumanjeri10-Sep-09 5:30 
GeneralRe: Creating a Time Provider in C++ Pin
David Crow10-Sep-09 5:42
David Crow10-Sep-09 5:42 
GeneralRe: Creating a Time Provider in C++ Pin
bijumanjeri10-Sep-09 5:50
bijumanjeri10-Sep-09 5:50 
AnswerRe: Creating a Time Provider in C++ Pin
Randor 10-Sep-09 6:02
professional Randor 10-Sep-09 6:02 
GeneralRe: Creating a Time Provider in C++ Pin
bijumanjeri10-Sep-09 18:31
bijumanjeri10-Sep-09 18:31 

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.