The difference | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 4

The difference

In Java I can do this : class Program extends Vector { } why can't I do this in c++ class Program : public vector { }; can AnyOne tell me why??

25th May 2017, 5:39 AM
Luyanda
Luyanda - avatar
2 Réponses
+ 1
vector is a template class, so you'd have to implement the template parameter(s), like so template <class T, class Alloc = std::allocator<T>> class Program : public std::vector<T, Alloc> { ... };
25th May 2017, 1:09 PM
Madera Oxidada
Madera Oxidada - avatar
+ 2
@Madera That means I can do it. but I didn't know how. Thank you.
25th May 2017, 1:39 PM
Luyanda
Luyanda - avatar