programminga general overview the fourth rulewhich will be justified (along with its nicknamein later sectionsis the reason that it is generally bad idea to use recursion to evaluate simple mathematical functionssuch as the fibonacci numbers as long as you keep these rules in mindrecursive programming should be straightforward +classes in this textwe will write many data structures all of the data structures will be objects that store data (usually collection of identically typed itemsand will provide functions that manipulate the collection in +(and other languages)this is accomplished by using class this section describes the +class basic class syntax class in +consists of its members these members can be either data or functions the functions are called member functions each instance of class is an object each object contains the data components specified in the class (unless the data components are statica detail that can be safely ignored for nowa member function is used to act on an object often member functions are called methods as an examplefigure is the intcell class in the intcell classeach instance of the intcell--an intcell object--contains single data member named storedvalue everything else in this particular class is method in our examplethere are four methods two of these methods are read and write the other two are special methods known as constructors let us describe some key features firstnotice the two labels public and private these labels determine visibility of class members in this exampleeverything except the storedvalue data member is public storedvalue is private member that is public may be accessed by any method in any class member that is private may only be accessed by methods in its class typicallydata members are declared privatethus restricting access to internal details of the classwhile methods intended for general use are made public this is known as information hiding by using private data memberswe can change the internal representation of the object without having an effect on other parts of the program that use the object this is because the object is accessed through the public member functionswhose viewable behavior remains unchanged the users of the class do not need to know internal details of how the class is implemented in many caseshaving this access leads to trouble for instancein class that stores dates using monthdayand yearby making the monthdayand year privatewe prohibit an outsider from setting these data members to illegal datessuch as feb howeversome methods may be for internal use and can be private in classall members are private by defaultso the initial public is not optional secondwe see two constructors constructor is method that describes how an instance of the class is constructed if no constructor is explicitly definedone that initializes the data members using language defaults is automatically generated the intcell class defines two constructors the first is called if no parameter is specified the second is called if an int parameter is providedand uses that int to initialize the storedvalue member