0

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.

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Luckychap
0

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

0

Try this as ur default contructor signature:

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.