0

Hi I found this example on about.com . I understand most of this, but one part is giving me problems in genral. I tried classes before, and it did not go over so well. But since this is someone else code, it might be better than mine :). Thanks

#include <iostream> #include <stdio.h>  class Book { int PageCount; int CurrentPage;  public: Book( int Numpages) ; // Constructor ~Book(){} ; // Destructor void SetPage( int PageNumber) ; int GetCurrentPage( void ) ; };   Book::Book( int NumPages) { PageCount = NumPages; }  void Book::SetPage( int PageNumber) { CurrentPage=PageNumber; }  int Book::GetCurrentPage( void ) { return CurrentPage; }  int main() { Book ABook(128) ; ABook.SetPage( 56 ) ; std::cout << "Current Page " << ABook.GetCurrentPage() << std::endl; return 0; }

here is the link to the article:http://cplus.about.com/od/learning1/ss/cppobjects.htm

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Fbody
0

Did you bother to read pages 2-4 of the article you linked? They explain fairly well...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.