Hello everyone I have to create a class that has the following:
Your Field class is the base class from which you will derive all other Field classes.
Your Field class has the following public member functions, all of which are virtual:
* void display() - does nothing here, but will display the field in derived classes.
* int edit() - does nothing here and returns 0, but will edit the field in derived classes.
* bool editable() const - returns false here, but will return the editability of the field in derived classes.
* void *data() - returns NULL here, but will return the address of data stored in the field in derived classes.
* Field *clone() const - returns NULL here, but will create a clone of the field in derived classes.
I would like some input if I did the above correctly.
This is what is in my header file:
class Field{
public:
virtual void display();
virtual int edit();
virtual bool editable() const;
virtual void *data();
virtual Field *clone() const;
};
This is what I have in my cpp file:
// Field Class functions
void Field::display(){
}
int Field::edit(){
return 0;
}
bool Field::editable() const{
return false;
}
void Field::*data(){
return NULL;
}
void Field::*clone() const{
return NULL;
}
I am getting errors with what I currently have and decided to break it down piece by piece. I would like to know if what I did is correct, any input is highly appreciated.