View Single Post
  #2 (permalink)  
Old April 10th, 2005, 02:02 AM
Alan-LB Alan-LB is offline
Authorized User
 
Join Date: Mar 2005
Location: Wagga Wagga, NSW, Australia.
Posts: 60
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to Alan-LB Send a message via Yahoo to Alan-LB
Default


class Box // Class of Box - this is a description not an Instance
{
  public: // Any client can access Public Methods
    void SetWidth(int Input); // Declaration of Method to set width
  private: // Members are only available through Methods
    int Width, Length, Height; // Class Members (Properties)
}

void Box::SetWidth(int Input) // Definition of Method to set width
{
  Width = Input;
}

Box MyBox; // Object (Instance) MyBox of Class Box

MyBox.SetWidth(2); // This will set the Width for the Object MyBox to 2

--------------------------------------------------------------------

In C++ Properties are known as "Member Variables" or "Data Members"

Does this help??

Alan.


Reply With Quote