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
Insertion sort - C program: Write a program in c to define a insertion sort. void main()  {   clrscr();   int a[100],ch,n;   cout   cin>>n;   for (int i=0

Define the Data Types of c language? The C has a concept of 'data types' which are used to define a variable before its use and the definition of a variable will assign storage

program to write superposition of waves using class and objects

Q: Name the operators which cannot be overloaded? A:sizeof, ., .*, .->, ::, ?:

how to create program in c that will system restart

write a c program that multiplies 3 martices

basic salary of an employe.the allowence are House rent 20% of basic salary Medical allowence is 10% of basic salary conveyence allowence is 10% calculate anrd display gross salar

Using a Friend Using a friend function is quite easy. The following example explains a friend function to access members of two classes. class Bclass;

I can''t figure out how to stop the programming from hitting for the player even when they type in stand.

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b