How to declare a virtual member (not a function) in a class
    Adnan 
    relay.public.adnan at outlook.com
       
    Tue Feb 18 12:37:45 UTC 2020
    
    
  
I have a base class that has a couple of constant member 
variables. These variables are abstract, they will only get 
defined when the derived class gets constructed.
class Person {
     const string name;
     const int id;
}
class Male : Person {
     this(string name = "Unnamed Male") {
         static int nextID = 0;
         this.id = nextID++;
         this.name = name;
     }
}
The compiler restricts me from assigning those two functions. How 
can I get around this?
    
    
More information about the Digitalmars-d-learn
mailing list