Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //type signature for primitive types
- #include <iostream>
- #include <memory>
- #include <vector>
- //forward declaration
- class RadObject;
- typedef std::shared_ptr<RadObject> RadPtr;
- enum RadType
- {
- RadType_Int,
- RadType_String,
- RadType_Bool,
- RadType_Reaction,
- RadType_Stream
- };
- class RadObject
- {
- private:
- RadType type;
- public:
- RadObject();
- ~RadObject();
- RadType getType()
- {
- return type;
- }
- void setType(RadType type)
- {
- type = type;
- }
- };
- class RadInt: public RadObject
- {
- public:
- long value;
- RadInt(long val): value(val)
- {
- setType(RadType_Int);
- }
- };
- class RadStream: public RadObject
- {
- private:
- std::vector<RadPtr> items;
- public:
- RadStream()
- {
- setType(RadType_Stream);
- }
- void append(RadPtr rptr)
- {
- items.push_back(rptr);
- }
- };
- int main()
- {
- std::cout << "hello" << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement