Advertisement
Guest User

Untitled

a guest
Jun 6th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. 1.b. NID Number
  2. Birth ID
  3. 3.a.) Members of a class are private by default and members of struct are public by default.
  4. As the attributes of the person such as his/her personal information should be private so I will choose class.
  5. b. class Test
  6. {
  7. int name,age,date_of_birth,fathers_name,mothers_name,address,nid_no;
  8. void set_name(string name)
  9. {
  10. this.name=name;
  11. }
  12. int set_nid(int)
  13. {
  14. this.nid_nod=nid;
  15. }
  16. void set_age(int age)
  17. {
  18. this.age = age;
  19. }
  20. void set_address(string address )
  21. {
  22. this.address=address;
  23. }
  24. void set fathers_name( string name )
  25. {
  26. this.fathers_name = name ;
  27. }
  28. void set mothers_name( string name )
  29. {
  30. this.mothers_name = name ;
  31. }
  32. int get_nid()
  33. {
  34. return this.nid_no;
  35. }
  36. public :
  37. int get_age()
  38. {
  39. return this.age;
  40. }
  41. string get_name()
  42. {
  43. return this.name;
  44. }
  45. string get_address()
  46. {
  47. this.address;
  48. }
  49. string get_fathers_name( )
  50. {
  51. this.fathers_name;
  52. }
  53. string get_mothers_name()
  54. {
  55. this.mothers_name ;
  56. }
  57.  
  58.  
  59.  
  60. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement