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
Write a program consisting of two functions (plus main). The first function should read in a number and then pass this back to main. This value should then be passed into a secon

Question: (a) What is a function? Are functions needed when writing a C program? (b) State one of the advantages to the use of functions. (c) What do you meant by underst

what would be the best tool for debuggingg memory leaks in c/c++ programming


Demonstration using Moss Open Source Machine Translation Project Description: Moses is an open source Statistical Machine Translation System. I need someone to provide me a d

A: No. Syntax wise it is permitted. But then the function is no longer Inline. Since the compiler will never know how deep the recursion is at compilation time.

Implement the search property from catalogue menu option.  After selecting this option the user should be asked to specify the property using the following sub-menu: 1. Specif

C program to string compression: Write a program to define a sting and all operations on string. void main()                                 {

Write a simple generic version of method isEqualTo that compares its two arguments with the equals method and returns true if they are equal and false otherwise. Use this generic m

The absolute land-speed record of 763.035 MPH (Mach 1.02) was set in October 15 1997 by a jet-powered car called Thrust SSC in the Black Rock Desert of northern Nevada. The team th