class code

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 16
Reputation: bis student is an unknown quantity at this point 
Solved Threads: 0
bis student's Avatar
bis student bis student is offline Offline
Newbie Poster

class code

 
0
  #1
Apr 10th, 2008
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
  1. struct Address {
  2. int house ,road ,block;
  3. string city,country;
  4. }add;
  5. BloodDonor(int =0,string =" ",string =" ",string =" ",int add.house=0,int add.road=0,);
there are some errors.
there are always hope
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,839
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: class code

 
0
  #2
Apr 10th, 2008
Why not use an enum for the blood type instead? That way you don't have to validate a random string.
New members chased away this month: 3
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 319
Reputation: Luckychap is on a distinguished road 
Solved Threads: 42
Luckychap's Avatar
Luckychap Luckychap is offline Offline
Posting Whiz

Re: class code

 
0
  #3
Apr 10th, 2008
Try this as ur default contructor signature:

BloodDonor(int id=0,string name=" ",string bGroup=" ",string hPhone=" ",string mPhone="", Address myAdd={0,0,0,"",""});
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC