Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.b. NID Number
- Birth ID
- 3.a.) Members of a class are private by default and members of struct are public by default.
- As the attributes of the person such as his/her personal information should be private so I will choose class.
- b. class Test
- {
- int name,age,date_of_birth,fathers_name,mothers_name,address,nid_no;
- void set_name(string name)
- {
- this.name=name;
- }
- int set_nid(int)
- {
- this.nid_nod=nid;
- }
- void set_age(int age)
- {
- this.age = age;
- }
- void set_address(string address )
- {
- this.address=address;
- }
- void set fathers_name( string name )
- {
- this.fathers_name = name ;
- }
- void set mothers_name( string name )
- {
- this.mothers_name = name ;
- }
- int get_nid()
- {
- return this.nid_no;
- }
- public :
- int get_age()
- {
- return this.age;
- }
- string get_name()
- {
- return this.name;
- }
- string get_address()
- {
- this.address;
- }
- string get_fathers_name( )
- {
- this.fathers_name;
- }
- string get_mothers_name()
- {
- this.mothers_name ;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement