how can I check the donor if valid by using switch
function Is_BloodBroup_Valid // takes a string as parameter and return true if it is a valid
group and false if not. The only possible blood groups are A+, A-, B+, B-, 0+, 0-,
AB+, AB-.

also if I have a Constructor function with default values and one of the parameters was of struct type how I can assign value to it , like this
1. Constructor function with default values IdNumber = 0, name = "", bloodGroup = "",
home_Phone="", mobile_Phone="", address={0,0,0,"",""} An overloaded constructor that takes the same parameters of the constructor in except
Address for the address
this was my try

struct Address {
	int house ,road ,block;
	string city,country;
}add;
BloodDonor(int  =0,string  =" ",string =" ",string =" ",int add.house=0,int add.road=0,);

there are some errors.

Why not use an enum for the blood type instead? That way you don't have to validate a random string.

Try this as ur default contructor signature:

BloodDonor(int id=0,string name=" ",string bGroup=" ",string hPhone=" ",string mPhone="", Address myAdd={0,0,0,"",""});

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.