fork download
  1.  
  2.  
  3. namespace VG {
  4. class Point{
  5. public:
  6. constexpr Point(const int x, const int y) : myX{x},myY{y} {}
  7. constexpr int getX() const;
  8. constexpr int getY() const;
  9. private:
  10. const int myX, myY;
  11. };
  12. }
  13.  
  14. namespace VG {
  15.  
  16. constexpr int Point::getX() const {
  17. return myX;
  18. }
  19.  
  20. constexpr int Point::getY() const {
  21. return myY;
  22. }
  23. }
  24.  
  25. void test()
  26. {
  27. constexpr int i = VG::Point{4, 5}.getX();
  28. static_assert(i==4, "oops");
  29. }
  30.  
  31. int main() {
  32. test();
  33. return 0;
  34. }
Success #stdin #stdout 0s 4352KB
stdin
Standard input is empty
stdout
Standard output is empty