Re: urgent about STDMETHOD

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



This is used to define a COM interface:

STDMETHOD is a macro that defines the calling conventions of the method
(__stdcall), and its return type (HRESULT).
The "==0" means that the method is not defined(*) in the class being
declared, and must be overridden (redefined) in a class that derives from
this class. In short, the class is an interface and the derived class
implements that interface.

S.

(*) Technically this is called a pure virtual function. It is allowed,
although unusual, to have a definition for a pure virtual function in the
base class-- to give some default functionality that the overriding function
can or must call-- but either way, you still must provide a definition for a
function in some derived class.


.



Relevant Pages

  • Re: IUnknown
    ... QueryInterface should be a pure virtual function. ... Then, when you implement a COM interface, you inherit from that interface, ... virtual HRESULT STDMETHODCALLTYPE QueryInterface( ...
    (microsoft.public.vc.language)
  • Re: IUnknown
    ... QueryInterface should be a pure virtual function. ... Then, when you implement a COM interface, you inherit from that interface, ... virtual HRESULT STDMETHODCALLTYPE QueryInterface( ...
    (microsoft.public.vc.language)
  • Re: Class Inheritance vs Interface Inheritance
    ... If a pure virtual function has an implementation, it usually serves as a default implementation, with the purpose of being called from an inherited class. ... I think it sort of undermines the purity of the interface concept. ... When we talk about interfaces as design patterns, we assume that the class has no data members. ...
    (microsoft.public.vc.language)
  • Re: non-pure virtual function in C++ interface
    ... can provide non-pure virtual function. ... Previously I think in interface, ... pure virtual function is allowed. ... Tim Roberts, timr@xxxxxxxxx ...
    (microsoft.public.vc.language)
  • Re: Mixing explicit implementation and polymorphism?
    ... You've implemented the interface explicitly, ... explicit implementation when a derived class has implemented the same ... declares a public member function that can be called by the derived class. ... -- Implicitly implemented interfaces can be virtual, overridden, and base implementations can be called by derived classes. ...
    (microsoft.public.dotnet.languages.csharp)