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

Recommended Answers

All 2 Replies

What exactly is giving you difficulties?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.