class data members class-level data member is often used when there is some valuesuch as constantthat is to be shared by all instances of class in such caseit would be unnecessarily wasteful to have each instance store that value in its instance namespace as an examplewe revisit the predatorycreditcard introduced in section that class assesses $ fee if an attempted charge is denied because of the credit limit our choice of $ for the fee was somewhat arbitraryand our coding style would be better if we used named variable rather than embedding the literal value in our code oftenthe amount of such fee is determined by the bank' policy and does not vary for each customer in that casewe could define and use class data member as followsclass predatorycreditcard(creditcard)overlimit fee this is class-level member def charge(selfprice)success supercharge(priceif not successself balance +predatorycreditcard overlimit fee return success the data memberoverlimit feeis entered into the predatorycreditcard class namespace because that assignment takes place within the immediate scope of the class definitionand without any qualifying identifier nested classes it is also possible to nest one class definition within the scope of another class this is useful constructwhich we will exploit several times in this book in the implementation of data structures this can be done by using syntax such as class aclass bthe outer class the nested class in this caseclass is the nested class the identifier is entered into the namespace of class associated with the newly defined class we note that this technique is unrelated to the concept of inheritanceas class does not inherit from class nesting one class in the scope of another makes clear that the nested class exists for support of the outer class furthermoreit can help reduce potential name conflictsbecause it allows for similarly named class to exist in another context for examplewe will later introduce data structure known as linked list and will define nested node class to store the individual components of the list we will also introduce data structure known as tree that depends upon its own nested