C++ COM Interface, ATL, Virtual Function

Objectives :

  • myClassCOMVtable1.cpp
     Component Object Model, created with an objective to deliver software in non-windows platform, such as Solaris and Unix ( and it's flavors).
    ATL: Active Template Library
      ATL is a C++ framework, and is used to develop COM components.
  • COM interfaces are built using a VTable, which is a function defined with a keyword "virtual".
    class Base{
    virtual void print(){};
  • A class containing a virtual function is known as Abstract Class.
  • As you noted that it just carries a signature of a function.
  • The class that will inherit a virtual class, must define the same function.
  •  Binding Type
    • Late Binding : The virtual functions are resolved at the run-time, like a late binding function.
    • Early Binding: object->function(); // with arrow operator/pointer
  • Code: myClassCOMVtable1.txt , myClassCOM_Non_Vtable1.txt

Step: 1 Create a source file.

Step: 2 Edit and save Source file

Step: 3 Runtime Views:

Step: Brief Discussion: if you don't use virtual, the print function will not be called.

Note console is blank.