fork download
  1. #include <iostream>
  2. #include <list>
  3. #include <iomanip>
  4.  
  5. class cic;
  6.  
  7. template <class T>
  8. class mylist : public std::list<T>
  9. {
  10. public:
  11.  
  12. mylist() {}
  13. mylist * value;
  14. };
  15.  
  16. class cic {
  17. public:
  18. int rad;
  19. int height;
  20. double sqr;
  21. double cap;
  22. cic(int,int,double,double);
  23. };
  24.  
  25. std::ostream &operator << (std::ostream & s, const cic& c )
  26. {
  27. return s << c.rad << " " << c.height; // etc
  28. }
  29.  
  30. cic::cic(int newRad,int newHeight,double newSqr, double newCap):
  31. rad(newRad),
  32. height(newHeight),
  33. sqr(newSqr),
  34. cap(newCap){
  35.  
  36. }
  37.  
  38.  
  39. int main(){
  40. mylist<cic>::iterator it;
  41. mylist<cic>list;
  42. list.push_back(cic(8, 4, 312.23, 12425.23));
  43. list.push_back(cic(9, 3, 132.23, 95.23));
  44.  
  45. for( const auto& e : list )
  46. {
  47. std::cout << e << std::endl;
  48. }
  49. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
8 4
9 3