| WideStudio Programming Guide | WideStudio 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.70 for WideStudio ver 3.70, May 2004

WideStudio documents index | Table of contents

Copyright(C) WideStudio Development Team, 1999-2004 | Last modified: May 25, 2004