What do you mean, a classroom based on another class or a list?



  • What do you mean, a classroom based on another class or a list? It's probably a question, but I can't move in, which means a class pattern based on a structure or another class.



  • Imagine. http://ru.wikipedia.org/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_(%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0) Obviously, well realized The list should be able to read elements of an arbitrary type.

    So we should be able to inform the compiler that, say, объект A1 - it's a list for whole numbers. объект A2 - it's a list for the chemicals.


    Equivalent. C++:

    List<int> A1;
    List<float> A2;
    

    However, it is understandable that the use of shabloan classes does not end. Whole or substances type. It is easy to imagine a list of the element Another list of whole numbers.

    This will be recorded in the following manner and as an example of a template based on any other class (in this case on the basis of List<int>)

    List<List<int> > A3;
    

    It is clear that ideologically all examples are some private cases. List<Object>




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2