Original Post
I have the c++ book "C++ the complete reference 2nd edition" 1990
it refers to template as a keyword "reserved for future use"
What is a template?
template<typename SomeType>
class Twin {
SomeType first_twin;
SomeType second_twin;
};
class Object;//some object
void main() {
Twin<int> int_twin; //generate a twin of ints
int_twin.first_twin is an int, and you can use it as int;
int_twin.second_twin is an int as well..;
Twin<Object> obj_twin; //generate a twin of objects
obj_twin.first_twin is here an 'Object';
obj_twin.second_twin as well..;
}
#include <vector>
...
vector<Object> object_array; //creates a dynamic sizeable array of Objects
Object x; //creates an Object
object_array.push_back(x); //adds the Object to the array
quote:
Original post by lone_ranger
I have the c++ book "C++ the complete reference 2nd edition" 1990
quote:
Original post by Arild Fines
You really, really need a newer book if you are serious about learning C++. Anything published earlier than 1999 should be considered suspect.
quote:Those ought to be public
Original post by davepermen
template
class Twin {
SomeType first_twin;
SomeType second_twin;
};
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more