Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. //type signature for primitive types
  2. #include <iostream>
  3. #include <memory>
  4. #include <vector>
  5.  
  6. //forward declaration
  7. class RadObject;
  8.  
  9. typedef std::shared_ptr<RadObject> RadPtr;
  10.  
  11. enum RadType
  12. {
  13. RadType_Int,
  14. RadType_String,
  15. RadType_Bool,
  16. RadType_Reaction,
  17. RadType_Stream
  18. };
  19.  
  20. class RadObject
  21. {
  22. private:
  23. RadType type;
  24. public:
  25. RadObject();
  26. ~RadObject();
  27.  
  28. RadType getType()
  29. {
  30. return type;
  31. }
  32. void setType(RadType type)
  33. {
  34. type = type;
  35. }
  36.  
  37. };
  38.  
  39. class RadInt: public RadObject
  40. {
  41. public:
  42. long value;
  43. RadInt(long val): value(val)
  44. {
  45. setType(RadType_Int);
  46. }
  47. };
  48.  
  49. class RadStream: public RadObject
  50. {
  51. private:
  52. std::vector<RadPtr> items;
  53. public:
  54. RadStream()
  55. {
  56. setType(RadType_Stream);
  57. }
  58.  
  59. void append(RadPtr rptr)
  60. {
  61. items.push_back(rptr);
  62. }
  63. };
  64.  
  65. int main()
  66. {
  67. std::cout << "hello" << "\n";
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement