|
I have three classes:
A data holder class CDataHolder, which uses a Pimpl pattern
class CDataHolder { public: // ... private: friend class CBase; struct PImpl; PImpl* iPimpl; };
A base class CBase, which need to access the iPImpl member in CDataHolder...
Started by douyw on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Since you have declared struct PImpl in the private part of CDataHolder class, only friends section or even better before the CDataHolder class?
Friend is (rightfully) very limited and can't aspect of it, or B) you need the DataHolder ....
|
|
Recently one of my friend asked me how to prevent class inheritance in C++. He wanted the compilation to fail.
I was thinking about it and found 3 answers. Not sure which is the best one.
1) Private Constructor(s)
class CBase { public: static CBase* CreateInstance...
Started by ring0 on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
To answer your question, you can't inherit from CBase because in virtual inheritance a derived class, a class that would derive from CBase would need to have direct access to CSealed which it can't since compile CSealed(....
|
|
The "ATL simple object" wizard doesn't provide a way to specify that a new class is derived from an existing coclass and its interface. In Visual Studio 2008, how do I make a new ATL COM class derived from an existing one (i.e. Base implements IBase, ...
Started by Qwertie on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Well, I received some links implement code such that the real logic that... .
CBaseLogic : IBase class ATL_NO_VTABLE CBase : public, add these base classes to the resulting class declaration.
Old C++ class say CBaseLogic.
|
Ask your Facebook Friends
|
I have a base class:
class CBase { public: virtual void SomeChecks() {} CBase() { /* Do some checks */ SomeChecks(); /* Do some more checks */ } };
and a derived class:
class CDerived : public CBase { public: virtual void SomeChecks() { /* Do some other...
Started by To1ne on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
CBase { void SomeChecks() {}; public: CBase() { /* Do some checks */ SomeChecks(); } }; class { CFive(): C<C::cNoCheck>(5) {} };
Maybe this works for you:
class CBase { public: CBase about this*/ virtual....
|
|
As I understand it, what makes dynamic cast different from a static cast is its use of RTTI, and the fact that it fails if the dynamic type of a variable- when casting from base to derived- does not fit. But why does the class have to be polymorphic for...
Started by EpsilonVector on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
(The assumed implementation:
Further, a class with virtual functions is often called a polymorphic class and polymorphic classes are the only ones that can....
RTTI information is available only for class with a virtual member.
|
|
Hi everybody
I am puzzled. Please have look at the program below:
class CBase{
:
};
class CDerived:public CBase{
:
};
main()
{
CBase* ptr; CDerived* p = new CDerived;
ptr == p;
delete ptr;//[Question]
}
Started by Viorel_ MVP on
, 5 posts
by 2 people.
Answer Snippets (Read the full thread at microsoft):
Consider:
class Base { }; class Derived : public....
In order to solve the problem, add a virtual destructor to CBase delete a derived object using a pointer to the base, correct destructor is called.
Of CDerived will not be executed too.
|
|
I want to add a operator override to perform assignments /__set__s inline.
Template :-
class CBase { public : static void SetupVmeInterface(CVmeInterface *in); protected : static CVmeInterface *pVmeInterface; }; template <class T> class TCVmeAccess...
Started by IanVaughan on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Template <class T> class TCVmeAccess : public CBase, public T { public: TCVmeAccess(int to the complete _HVPSUControl struct?
template <class T> class TCVmeAccess : public CBase { public it in HVPSUControl....
|
|
I've managed to program the following THWorkingMemory class, into a antipattern, the God Object. I planned it to be a fairly small class with around 20 methods, but now it's packed with queue handlers, timers, threads, callbacks, powershell queue callbacks...
Answer Snippets (Read the full thread at stackoverflow):
class THWorkingMemory { class....
For example, given a skeleton like this ...
With a reference to the containing class, so that they could use the instance member data and/or invoke the instance methods of the containing class.
|
|
Suppose I have following code:
public class CBase: AbstractC,IRenderable { //code here } public class CBaseGroup { private List<IRenderable> CCollection; public CBaseGroup(List<IRenderable> c) { CCollection=c; } } public class CGroup:CBaseGroup...
Started by Jenea on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Well, on line 1, you need to include the parent class before any interfaces
public class CBase: AbstractC, IRenderable
To get the effect you want you'd need to do something like
public class(List<T> c) {....
Question.
|
|
On Tue, 18 Nov 2008 09:01:01 -0800, Qwertie <qwertman-at@at-hotmail.com
The "ATL simple object" wizard doesn't provide a way to specify that a new
class is derived from an existing coclass and its interface. In Visual Studio
2008, how do I make...
Started by Qwertie on
, 12 posts
by 2 people.
Answer Snippets (Read the full thread at omgili):
Something like
class CBase : public CComCoClass<CBase
If you now write
class CDerived : public CBase;qwertman-at@at-hotmail.com
class CBase : public CComObjectRoot, public IA {
public:
BEGIN_COM....
|