Thread: Question about UML.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    88

    Question about UML.

    For this diagram:
    http://chorist.mis.ccu.edu.tw/teachi...al/final_5.jpg
    Let's talk about the class "S" and "T" only.
    Should I write like this:
    Code:
    class S{
    public:
      void setID();
      int getID();
      void printID();
    private:
       int i ;
    };
    
    class T : public S{
    protected:
      int j;
    };
    or this ?
    Code:
    class S{
    public:
      void setID();
      int getID();
      void printID();
    private:
       int i ;
    };
    
    class T : public S{
    public:
      void setID();     //  <<< different at here
      int getID();
      void printID();
    protected:
      int j;
    };
    The 'i' and 'j' are not important.
    The main point is whether I should write the functions repeatedly in the inheritance.

    My teacher give me the model answer like the second form. I am wondering because I believe that the first form is correct.

    thx.

    ref:
    '+' = public
    '-' = private
    '#' = protected
    Last edited by L.O.K.; 01-14-2005 at 01:18 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  2. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. Question about linked lists.
    By cheeisme123 in forum C++ Programming
    Replies: 6
    Last Post: 02-25-2003, 01:36 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM