Change os source- reformulating

C

Constant

I have this sub class that I need to reformulate ..change the source
but the action(result) should be the same.
Can someone reformulate this source code for me?
I would greatly appreciate


Thanks a lot !




class student:public person{ //Seudent inherits form Class person
private:

int studentNo;

public:
/*Student contructor*/
student(char *sn, char *gn, char *addr, char *bDay, int sNo)
:person(sn,gn,addr,bDay){
studentNo=sNo;
}
void showStudentNo(){
cout<<"Sudent No: "<<studentNo<<endl;
}
};
 
P

Patrick Kowalzick

Hi Constant,
class student:public person{ //Seudent inherits form Class person
private:

int studentNo;

public:
/*Student contructor*/
student(char *sn, char *gn, char *addr, char *bDay, int sNo)
:person(sn,gn,addr,bDay){
studentNo=sNo;
}

Here you should ask your theacher why the constructor call is not like:

stundent(const string &,const string &,const string &,const string &,const
int&);

it must be a very old program which is extended now.
void showStudentNo(){
cout<<"Sudent No: "<<studentNo<<endl;
}

Since I assume that you did not introduce a global "using namespace std" it
should be

std::cout << "Student No: " << studentNo << std::endl:

Regards,
Patrick
 
K

Karl Heinz Buchegger

Constant said:
I have this sub class that I need to reformulate ..change the source
but the action(result) should be the same.
Can someone reformulate this source code for me?

Well. If you tell us what you don't like about it.
There are some things like: switching completely to
initializer lists, using std::string instead of char*,
using namespace std.
But I'm sure you can do all of this changes by yourself,
they are trivial to do.

So what is it, that you want to be changed?
 
H

Howard

Constant said:
I have this sub class that I need to reformulate ..change the source
but the action(result) should be the same.
Can someone reformulate this source code for me?
I would greatly appreciate


Thanks a lot !




class student:public person{ //Seudent inherits form Class person
private:

int studentNo;

public:
/*Student contructor*/
student(char *sn, char *gn, char *addr, char *bDay, int sNo)
:person(sn,gn,addr,bDay){
studentNo=sNo;
}
void showStudentNo(){
cout<<"Sudent No: "<<studentNo<<endl;
}
};

Reformulated? What do you want changed? Let me guess...given your other
question was asking to get your homework solved for you, what you want here
is to change this code around so that it looks like YOU wrote it, instead of
it being exactly like someone else's (who you "borrowed" it from)? I'd say
you should do your own homework and come back here when you actually need
real help, not when you want to cheat!
-Howard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,112
Latest member
VinayKumar Nevatia
Top