levur

ip.cpp

Aug 29th, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include "ip.h"
  2. #include "octet.h"
  3. #include <string>
  4.  
  5.  
  6. IP::IP(Octet a1, Octet a2, Octet a3, Octet a4)
  7. {
  8. Octet partie1, partie2, partie3, partie4;
  9.  
  10. partie1 = a1;
  11. partie2 = a2;
  12. partie3 = a3;
  13. partie4 = a4;
  14. }
  15.  
  16. IP::~IP()
  17. {
  18. //dtor
  19. }
  20.  
  21. std::string IP::ToBits()
  22. {
  23. std::string rep = partie1.ToBits() + "." + partie2.ToBits() + "." + partie3.ToBits() + "." + partie4.ToBits();
  24. return rep;
  25. }
  26.  
  27. int IP::getOct1()
  28. {
  29. return partie1.getOctet();
  30. }
  31.  
  32. int IP::getOct2()
  33. {
  34. return partie2.getOctet();
  35. }
  36.  
  37. int IP::getOct3()
  38. {
  39. return partie3.getOctet();
  40. }
  41.  
  42. int IP::getOct4()
  43. {
  44. return partie4.getOctet();
  45. }
Advertisement
Add Comment
Please, Sign In to add comment