pointer equality and inheritance

From: sb (spam_bait101_at_yahoo.com)
Date: 04/01/04


Date: 1 Apr 2004 13:28:43 -0800

Given this relationship,

class Base {
 //...
};

class Derived : public Base {
 //...
 bool myself(const void* p) { return p == this}
};

Is there a guarantee in the standard that

Derived d;
Base* p = &d;
d.myself((void*)p); // - ?

will be always true?



Relevant Pages

  • Re: Deletion of a COM object in VC6.0
    ... > lauch2 wrote: ... template <class Base> ... class CComObjectCached: public Base ...
    (microsoft.public.dotnet.languages.vc)
  • Re: C2248: cannot access protected member
    ... class Base; ... class Derived: public Base { ... which is a fully-bound member function, ... Y can access the base implementation of protected member foo, ...
    (microsoft.public.vc.language)
  • Re: C2248: cannot access protected member
    ... class Base; ... class Derived: public Base { ... if Y is a subtype of X, then Y -> unit is a ... Y can access the base implementation of protected member foo, ...
    (microsoft.public.vc.language)
  • Re: Template Specialization, subclassing and overriding
    ... >> from hiding the declaration in baseClass. ... > class AClass ... > class derived: public base ...
    (comp.lang.cpp)
  • Re: design quicky
    ... > void f ... I think the first design could be OK, depending on how many news are ... Object Mentor Inc. ...
    (comp.object)