I'm using Emscripten to build my C++ source code to JavaScript, and I met some problem about how to write correct interface description in WebIDL file.
C++ code example:
class Base
{
public:
virtual bool is_true() const = 0;
virtual int get_count() const = 0;
}
class Child: public Base
{
public:
virtual bool is_true() const
{
return true;
}
virtual int get_count() const
{
return 10;
}
}
But how to write WebIDL especially about class Base
?
interface Base{
// ?
};
You can still provide an implementation of pure virtual functions outside the class definition. For instance, a pure virtual destructor is always called and hence must be implemented by the base.
class Base
{
public:
virtual bool is_true() const = 0;
virtual int get_count() const = 0;
}
bool Base::is_true() const { return false; }
int Base::get_count() const { return 0; }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.