What are the pros and cons of this code? /**************************************
ID: 3866305 • Letter: W
Question
What are the pros and cons of this code?
/*********************************************************************
** Description:
.
*********************************************************************/
#include
<iostream>
#include
<string>
#include
"Person.hpp"
using
namespace
std;
/*********************************************************************
** Description:
Constructor
uses
values
to initialize
data
members.
*********************************************************************/
Person::Person(string
pName,
double
pAge)
{
name
= pName;
age
= pAge;
}
/*********************************************************************
** Description:
Getter
methods.
*********************************************************************/
string
Person::getName()
{
return
name;
}
double
Person::getAge()
{
return
age;
}
Explanation / Answer
Pros:
Can be viewed with easy even on mobile devices without the each line crossing over to next line where the screen width is genrally narrower.
Such coding style is good when you have to send the source code, but does not want the client to decrypt the code with ease
Cons:
Not very readable code this is. It does need time for most user to understand the code and its useage!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.