Write code to implement constructor and assessors, C/C++ Programming

Study the given class specification and answer the questions that follow:

class Person

{

private:

  string name;

  int yrBorn;

  int yrDied;  

public:

  Person(string, int, int); // initialize all data members

  int getYrBorn(); // return year born

  int getYrDied(); // return year died

  void display(); // display all private data members

  int yrLived(); // return the difference between yrDied and yrBor

};

(a)  The access  specifiers used in the above class are private and public.  Explain these access specifiers.

(b)  Write code to implement  ALL  the methods found in the above class specification.

(i)  Constructor 

(ii)  Assessors

(iii)  display method 

(iv)  yrLived method

Posted Date: 3/23/2013 6:19:53 AM | Location : United States







Related Discussions:- Write code to implement constructor and assessors, Assignment Help, Ask Question on Write code to implement constructor and assessors, Get Answer, Expert's Help, Write code to implement constructor and assessors Discussions

Write discussion on Write code to implement constructor and assessors
Your posts are moderated
Related Questions
there is a pebble merchant. he sells the pebbles,that are used for shining the floor.his main duty is to take the length of the room side but he sometines mistakes doing that and m

program to check whether a given point lies inside a rectangle or not

write a grading program for a class with the following grading polices: a.there are two quizzes eaxh graded on the basis of 10 points b.there is ome midterm exam and one final exam

give a program to accept and print 2_D Array

What do you mean by a sequential access file? - When writing programs which store and retrieve data in a file, it's possible to designate that file into various forms. - A s

The heart of the modern electronic system is the microprocessor e.g. the video, sound, game consoles, portable phones and domestic appliances. Let us consider the heart of a home c

(a) Write a procedure that computes the Ackermann-Peter a(m,n) function. (b) Write a helper procedure that only allows the calculation of the Ackermann-Peter function for 0≤m

A: The simplest way is to use a stringstream: #include #include #include using namespace std; string itos(int i) // convert int to string { stringstream s;

E v o l u t i o n of Software: In the past stage of programming the software's were developed in Machine language Using binary numbers 1's and 0's.  Later it convert

When I develop a destructor, do I require to explicitly call the destructors for my member objects?