Why do you want Base to be a class template? Base<Empty> and Base<Ant> are two different classes so you will not be able to have a pointer that can point to both of them (except if you make them inherit from some common base class).
I want child classes to already have their static variables Beetle::myVar, Ant::myVar etc. without declaring them in those clases. This is how I figured out it can be possible. How can I do it? :)
The value of myVar is always going to be the value at which it was most recently assigned and it will be consistent throughout all the classes derived from your Base. That meaning if your Base assigns it the value of 5, every class that is derived from Base will have myVar at 5 until it is changed(this will affect every instance of every derived class).
If that's what you're trying to accomplish? I don't really follow what you're trying to do.
If what you just said Im doing, then no I dont want to accomplish it.
I have:
1 2 3 4 5 6 7 8 9 10 11
class Base{
staticint myVar;
};
class ChildOne : Base{
// has member myVar, but not same as in Base class
};
class ChildTwo : Base{
// has member myVar, but not same as in Base class or ChildOne class
};
I cant change values of these instances and they dont affect different classes.
That is what I want to accomplish. :) Im now stuck with this for 3rd hour. :(
And after that I want base class have virtual functions and use base class variable as pointer to extended classes.