Change os source- reformulating

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Constant

    Change os source- reformulating

    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,a ddr,bDay){
    studentNo=sNo;
    }
    void showStudentNo() {
    cout<<"Sudent No: "<<studentNo<<e ndl;
    }
    };
  • Patrick Kowalzick

    #2
    Re: Change os source- reformulating

    Hi Constant,
    [color=blue]
    > 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,a ddr,bDay){
    > studentNo=sNo;
    > }[/color]

    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.
    [color=blue]
    > void showStudentNo() {
    > cout<<"Sudent No: "<<studentNo<<e ndl;
    > }[/color]

    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


    Comment

    • Karl Heinz Buchegger

      #3
      Re: Change os source- reformulating



      Constant wrote:[color=blue]
      >
      > 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?[/color]

      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?

      --
      Karl Heinz Buchegger
      kbuchegg@gascad .at

      Comment

      • Howard

        #4
        Re: Change os source- reformulating


        "Constant" <cons_tant@yaho o.com> wrote in message
        news:5c5b9294.0 309170225.236ba f94@posting.goo gle.com...[color=blue]
        > 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,a ddr,bDay){
        > studentNo=sNo;
        > }
        > void showStudentNo() {
        > cout<<"Sudent No: "<<studentNo<<e ndl;
        > }
        > };[/color]

        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






        Comment

        Working...