WideStudio/MWT Logo
WideStudio/MWT
Programming Guide
WideStudio/MWT Index
Table of contents


How to access to the method of the specified class

In the chapter: [To cast the WSCbase* into the specified class], you can cast WSCbase* to the pointer of the specified class. Following example shows accessing of the method of WSClist class. WSClist class displays the list of some strings, and the WSClist::addString() method adds the specified string to the list.

#include "WSClist.h" //use WSClist class.

void some_function(...){
  //get the instance: name=list001, class=WSClist.
  WSCbase* object;
  object = (WSCbase*)WSGIappObjectList()->getInstance("WSClist","list001");

  //cast to WSClist pointer, and execute WSClist::addItem().
  WSClist* list = (WSClist*)object->cast("WSClist");
  list->addItem("sample string",0)
}

In the example, it gets the instance which name is "list001" and which class is WSClist from the instance management. The instance management returns WSCbase*, it casts WSCbase* to WSClist*,and executes the WSClist::addItem() method. In the top of the source, we must include the header file of the class.

Document Release 3.90 for WideStudio/MWT ver 3.90, Jul 2005


WideStudio/MWT documents index | Table of contents

Copyright(C) WideStudio/MWT Development Team, 1999-2005 Last modified: Jul 31, 2005