I have two classes, 1 base, and 1 the child. The base has a function print, so does the child.
Base:
Code:
class Property {
public:
Property();
char *getAddress();
void setAddress(char *s);
char *getOwner_Name();
void setOwner_Name(char *s);
char *getOwner_Address();
void setOwner_Address(char *s);
int getPrice();
void setPrice(int p);
char *getDate_Purchased();
void setDate_Purchased(char *s);
int getLot_Area();
void setLot_Area(int p);
char *getType();
void setType(char *s);
char *getStatus();
void setStatus(char *s);
void print();
protected:
char address[256];
char owner_name[256];
char owner_address[256];
int price;
char date_purchased[256];
int lot_area; // size of lot i'm guessing
char type[256]; //residential or commercial
char status[256];
};
the child:
Code:
class SingleFamilyHome : public Property {
public:
SingleFamilyHome();
int getDwelling_Area();
void setDwelling_Area(int i);
int getNumber_Of_Bed_Rooms();
void setNumber_Of_Bed_Rooms(int i);
int getNumber_Of_Baths();
void setNumber_Of_Baths(int i);
void print();
protected:
int dwelling_area;
int number_of_bed_rooms;
int number_of_baths;
};
in my main I've got this:
Code:
SingleFamilyHome h;
h.setAddress("address");
h.setDate_Purchased("date");
h.setLot_Area(104);
h.setOwner_Address("owneraddy");
h.setOwner_Name("ownername");
h.setPrice(100);
h.setStatus("status");
h.setType("type");
h.setDwelling_Area(1040);
h.setNumber_Of_Bed_Rooms(105);
h.setNumber_Of_Baths(10);
h.print();
// need to print data from Property as well
I need to print the data from the base class Property. How would I access that function. H has access to thsoe functions, but it defaults to the child print function first.