Click here to Skip to main content
15,896,557 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CBrush - color Pin
CPallini4-Jan-09 5:42
mveCPallini4-Jan-09 5:42 
QuestionWebbrowser control + ActiveX Pin
nobaq4-Jan-09 3:39
nobaq4-Jan-09 3:39 
QuestionRe: Webbrowser control + ActiveX Pin
nobaq4-Jan-09 4:10
nobaq4-Jan-09 4:10 
AnswerRe: Webbrowser control + ActiveX Pin
nobaq5-Jan-09 2:00
nobaq5-Jan-09 2:00 
Questionstatic-inheritance problem Pin
KasyaMafia4-Jan-09 3:32
KasyaMafia4-Jan-09 3:32 
QuestionRe: static-inheritance problem Pin
CPallini4-Jan-09 3:42
mveCPallini4-Jan-09 3:42 
AnswerRe: static-inheritance problem Pin
KasyaMafia4-Jan-09 4:33
KasyaMafia4-Jan-09 4:33 
GeneralRe: static-inheritance problem Pin
CPallini4-Jan-09 4:54
mveCPallini4-Jan-09 4:54 
This works for me:
class BVolume {
public:
enum { NONE = 0, SPHERE, BOX, PLANE };
	static const unsigned short type = NONE;

virtual bool TestCollision(BVolume * volume)=0;
virtual const unsigned int getType(){ return NONE;}

};

class BBox : public BVolume {
public:
static const unsigned short type = BOX;

bool TestCollision(BVolume * volume) { return Collision< volume -> type >(volume); }

template< unsigned short type > bool Collision(BVolume * volume) { return false; }


bool BoxCollision(BBox * box) { return true; } //For Testing That Code
virtual const unsigned int getType(){ return BOX;}

};


void main()
{
	BBox b1, b2;
	BVolume *pv1 = &b1;
	if ( pv1->getType() == BVolume::BOX) cout << "is a box" << endl;
}


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: static-inheritance problem [modified] Pin
KasyaMafia4-Jan-09 5:59
KasyaMafia4-Jan-09 5:59 
QuestionRe: static-inheritance problem Pin
CPallini4-Jan-09 6:14
mveCPallini4-Jan-09 6:14 
JokeRe: static-inheritance problem Pin
Mark Salsbery4-Jan-09 6:42
Mark Salsbery4-Jan-09 6:42 
GeneralRe: static-inheritance problem Pin
CPallini4-Jan-09 10:17
mveCPallini4-Jan-09 10:17 
GeneralRe: static-inheritance problem Pin
Mark Salsbery4-Jan-09 15:22
Mark Salsbery4-Jan-09 15:22 
AnswerRe: static-inheritance problem Pin
KasyaMafia4-Jan-09 7:20
KasyaMafia4-Jan-09 7:20 
GeneralRe: static-inheritance problem Pin
CPallini4-Jan-09 10:10
mveCPallini4-Jan-09 10:10 
Question. Pin
ninjamafiakhan34-Jan-09 1:04
ninjamafiakhan34-Jan-09 1:04 
AnswerRe: Windows application control through Serial port Pin
Richard Andrew x644-Jan-09 2:05
professionalRichard Andrew x644-Jan-09 2:05 
GeneralMessage Closed Pin
4-Jan-09 2:17
ninjamafiakhan34-Jan-09 2:17 
GeneralRe: Windows application control through Serial port Pin
Richard Andrew x644-Jan-09 2:23
professionalRichard Andrew x644-Jan-09 2:23 
GeneralMessage Closed Pin
4-Jan-09 2:45
ninjamafiakhan34-Jan-09 2:45 
GeneralRe: Windows application control through Serial port Pin
Richard Andrew x644-Jan-09 2:57
professionalRichard Andrew x644-Jan-09 2:57 
GeneralRe: Windows application control through Serial port Pin
Jijo.Raj4-Jan-09 2:54
Jijo.Raj4-Jan-09 2:54 
AnswerRe: Windows application control through Serial port Pin
Theo Buys7-Jan-09 1:47
Theo Buys7-Jan-09 1:47 
Questionthis my friand Pin
dadashri3-Jan-09 22:32
dadashri3-Jan-09 22:32 
Answerabuse Pin
CPallini3-Jan-09 23:01
mveCPallini3-Jan-09 23:01 

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.