KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want the derived class to be a descendant of a template class. That class depends on descendant's members. In short I want this code to compile: struct IBootParams { virtual bool GetImmediate() = 0; }; template <class T> struct TBootBootParams { typename T::TransType transferType; typename T::UseAbort_ useAbort; bool GetImmediate() { if ( transferType == T::e1 ) { return useAbort.someFlag; } return false; } }; struct BootBootParams : public TBootBootParams<BootBootParams> { enum SomeEnum { e1=0, e2, e3 }; struct UseAbort { bool someFlag; char someMember; int otherMember; } useAbort; typedef SomeEnum TransType; typedef UseAbort UseAbort_; }; struct BootAltBootParams : public TBootBootParams<BootAltBootParams> { enum SomeEnum { e1=5, e2, e3 }; struct UseAbort { bool someFlag; long long someMember; long long otherMember; } useAbort; typedef SomeEnum TransType; typedef UseAbort UseAbort_; }; int _tmain(int argc, _TCHAR* argv[]) { BootBootParams bp; BootAltBootParams bpa; bool f = bp.GetImmediate(); f = bpa.GetImmediate(); }
Tags (comma-separated)
Save Edits
Cancel