Thread: Class's

  1. #1
    Registered User big146's Avatar
    Join Date
    Apr 2003
    Posts
    74

    Class's

    I just want to make sure I understand this correctly before proceding further. Look at the comments in the code for the questions.
    Code:
    //========================================================================================
                                       //class definition
    class Time {
    
    public:
    	Time();
    	void setTime( int, int, int ); // <- Is this the member declaration/Interface ?
    	void printUniversal();
    	void printStandard();
    
    private:							
    	int hour;						// <- Data Members ?
    	int minute;
    	int second;
    
    };
    
    Time::Time()						// <- Member function definition/Implamentation ?
    {
    	hour = minute = second = 0;
    }
    big146

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I've never heard of the declaration being called "interface" before, but maybe someone calls it that. But otherwise, yes it is correct
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User big146's Avatar
    Join Date
    Apr 2003
    Posts
    74
    Quote Originally Posted by JaWiB
    I've never heard of the declaration being called "interface" before, but maybe someone calls it that. But otherwise, yes it is correct
    Ya that's how the book im reading describes it.That's why i wanted to make sure I was understanding it correctly.
    thk for the reply.
    big146

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Ya that's how the book im reading describes it.
    Odd. Most people use the terms declaration and definition for what your book apparently called interface and implementation. We usually use interface and implementation for the public member functions and anything that's hidden from client code, respectively.
    My best code is written with the delete key.

  5. #5
    Registered User big146's Avatar
    Join Date
    Apr 2003
    Posts
    74
    Quote Originally Posted by Prelude
    >Ya that's how the book im reading describes it.
    Odd. Most people use the terms declaration and definition for what your book apparently called interface and implementation. We usually use interface and implementation for the public member functions and anything that's hidden from client code, respectively.
    It uses both,That's why I was asking to make sure I understood it correctly.So I dont confuse one with the other. So let me see if I have this right. The interface is basicly the function prototype declared in the public: class definition.The implamentation is the function definitions of the prototypes declared in class definition public. And data members are private variables used to store or manipulate the data of the pulbic functions ?

    I wish these books would just describe it one way until you get a grasp on the concept.Sometime they call it something else without even telling you what it means.You just have to figure it out as you go.

    thks
    P.S. I am definitley eternally confuzzeled.
    Last edited by big146; 06-16-2004 at 08:43 AM.
    big146

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    You may want to get another book if you're confuzzled. I don't know which ones are good but plenty of people here do.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  7. #7
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >P.S. I am definitley eternally confuzzeled.
    That's not necessarily a bad thing.

    >I don't know which ones are good but plenty of people here do.
    Accelerated C++ is the way to go. Look for it at a book dealer near you...and far from you if they don't have it.
    My best code is written with the delete key.

  8. #8
    Registered User big146's Avatar
    Join Date
    Apr 2003
    Posts
    74
    >Accelerated C++ is the way to go.
    Is this a book for beginners? It sounds more like a fast paced book.
    big146

  9. #9
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    She knows what she's talking about. I haven't read it but I'm sure it's great. The better C++ books are standards-compliant and set things out in a way that basically everyone can understand, so I'm sure it will be fine.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  10. #10
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Is this a book for beginners?
    Yes.

    >It sounds more like a fast paced book.
    Well, it's a comparably small book, but IMHO it's the best beginning C++ book out right now. It teaches proper C++ without getting bogged down in details, yet still manages to pass a good deal of info to the reader.
    My best code is written with the delete key.

  11. #11
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,090
    Quote Originally Posted by Prelude
    It teaches proper C++ without getting bogged down in details.
    Wait ... you mean you don't need to get bogged down with details when learning C++?



  12. #12
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >you mean you don't need to get bogged down with details when learning C++?
    It depends on who you are. But for the most part, the basics can be learned and used productively without knowing every little detail and reason.
    My best code is written with the delete key.

  13. #13
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    The term interface really depends on the client object, the object using your class. For example, if your class is being inherited, the interface given by your class is all public and protected members and variables. If you are just using the object, then the interface is all public members and variables, and if your using friends, your interface to the object is all public, protected, and private members and variables.

  14. #14
    Registered User big146's Avatar
    Join Date
    Apr 2003
    Posts
    74
    Ok...I went and bought the book.Dang this book is small compared to the other 15 I HAVE. thanks for the info..I will read this and hopefully it will shed some light on these topics for me.
    big146

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can Nested class access parent class's private member?
    By meili100 in forum C++ Programming
    Replies: 4
    Last Post: 06-05-2009, 08:42 AM
  2. Replies: 2
    Last Post: 12-16-2006, 06:53 PM
  3. Trouble joining class's at compile time..
    By (Slith++) in forum C++ Programming
    Replies: 13
    Last Post: 07-08-2006, 01:39 AM
  4. accesing a class's overloaded [] via a pointer
    By mnj in forum C++ Programming
    Replies: 4
    Last Post: 03-11-2004, 04:35 PM
  5. member functions having the class's name
    By Linette in forum C++ Programming
    Replies: 8
    Last Post: 01-30-2002, 11:04 AM