fork download
  1. #include <string>
  2. using std::string;
  3.  
  4. struct Point {};
  5.  
  6. // Element.h
  7. enum orientation{ up, down, left, right };
  8.  
  9. class Element{
  10. public:
  11. float get_value() ;
  12. string get_unit();
  13. Point get_start_point();
  14. protected:
  15. //Element(); // To prevent instatiation
  16. float value;
  17. const string unit;
  18. Point starting_point;
  19. orientation direction;
  20.  
  21. };
  22.  
  23. class Resistance : public Element{
  24. public:
  25. Resistance(Point,float,orientation);
  26. private :
  27. const string unit = "Kohm";
  28. };
  29.  
  30. //Element.cpp
  31. float Element::get_value(){
  32. return value;
  33. };
  34. string Element::get_unit(){
  35. return unit;
  36. }
  37. Point Element::get_start_point()
  38. {
  39. return starting_point;
  40. }
  41. Resistance::Resistance(Point p, float value, orientation direction){
  42.  
  43. Resistance::starting_point = p;
  44. Resistance::value = value;
  45. Resistance::direction = direction;
  46. }
  47.  
  48. int main() {}
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty