// Master template // // CAUTION: DO NOT USE SAME ORDINALITY FOR A STRUCTURE AND A CLASS IN THE SAME PROGRAM // // In the following, (B) stands for behavior/output, (D) for debug // --------------------------------------------------------------------------------- // // VARIABLES AND FUNCTIONS OF AN OBJECT // // // Accessing public (B) data member by client - 100 // Object.Variable.Public.By Client // // Accessing protected (D) data member by client - 125 // // Object.Variable.Protected.By Client // Object.Variable.Protected.Client code does not have access to protected data member of the object // // Accessing private (D) data member by client - 150 // // Object.Variable.Private.By Client // Object.Variable.Private.Client code does not have access to private data member of the object // // // All functions public // // Accessing public (B) data member by dynamic member function - 200 // Object.Variable.Public.By Object Function // // Accessing protected (B) data member by dynamic member function - 225 // Object.Variable.Protected.By Object Function // // Accessing private (B) data member by dynamic member function - 250 // Object.Variable.Private.By Object Function // // // Accessing dynamic (D) data member by static member function - 300 // // Object.Variable.Public.By Class Function // OOP.Object.Variable.The variable is not a static member of the class, and cannot be accessed in a static function // // Accessing protected (D) data member by static member function // // Object.Variable.Protected.By Class Function // // Accessing private (D) data member by static member function // // Object.Variable.Private.By Class Function // Object.Variable.Private.Class (static) function does not have access to private data member of the object // // // Accessing dynamic data member with respect to the class - 325 // OOP.Object.Variable.The variable is not a static member of the class, and cannot be accessed with respect to the class // // // All public member functions // // Accessing public (B) member function by client // // Object.Function.Public.By Client - Further expanded below // // Accessing protected (D) member function by client - 400 // // Object.Function.Protected.By Client // Object.Function.Protected.Client code does not have access to protected member function of the object // // Accessing private (D) member function by client - 425 // // Object.Function.Private.By Client // Object.Function.Private.Client code does not have access to private member function of the object // // // Execution of constructor code (B) wrt object - 500 // Object.Constructor.By Client // // Execution of constructor with one or more parameters - 525 // Object.Initialization.Basic object // TO DO - RENAME // // Execution of constructor with incorrect number of parameters - 550 // Object.Constructor.Number of actual parameters in the call not equal to the number of formal parameters in the definition // TO DO - RENAME // // Execution of constructor with incorrect data types for parameters - 575 // Object.Constructor.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition // // Execution of selectors (B) wrt object - 600 // Object.Selector.By Client // TO DO - RENAME // // Value returned by the selector is ignored by the caller - 625 // Object.Selector.Value returned by the function is ignored by the caller // TO DO - RENAME // // Selector is called before data member is initialized - 650 // Object.Selector.Referencing variable before initializing its value // // Execution of mutators (B) wrt object - 700 // Object.Mutator.By Client // TO DO - RENAME // // Value returned by the mutator is ignored by the caller - 725 // Object.Mutator.Value returned by the function is ignored by the caller // TO DO - RENAME // // Mutator is called with incorrect number of parameters - 750 // Object.Mutator.Number of actual parameters in the call not equal to the number of formal parameters in the definition // TO DO - RENAME // // Mutator is called with incorrect data type for parameters - 775 // Object.Mutator.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition // // Execution of destructor code (B) wrt object - 800 // Object.Destructor.By Client // // Assigning an object to class instead of another object - 900 // // Object.Assignment.Aggregate.Assigning to class // Object.Assignment.Aggregate.Object cannot be assigned to a class // // Aggregate assignment from one object to another - 925 // Object.Assignment.Aggregate.Assigning object to variable // // Object passed as parameter to a function where it is accessed - 950 // Object.Parameter.Aggregate.Accessed // // Object passed as parameter to a function where it is modified - 975 // Object.Parameter.Aggregate.Modified // // --------------------------------------------------------------------------------- // // STATIC VARIABLE AND FUNCTION IN A CLASS // // // Accessing static public (B) data member by client - 1000 // Class.Variable.Public.Wrt Class // // Accessing static public (B) data member by client - 1025 // Class.Variable.Public.Wrt Object // // Accessing static protected (D) data member by client - 1050 // Class.Variable.Protected.By Client // // Accessing static private (D) data member by client - 1075 // Class.Variable.Private.By Client // // // Accessing static public (B) data member by static member function - 1100 // Class.Variable.Public.By Class Function // // Accessing static protected (B) data member by static member function - 1125 // Class.Variable.Protected.By Class Function // // Accessing static private (B) data member by static member function - 1150 // Class.Variable.Private.By Class Function // // // Accessing static public (D) data member by dynamic member function - 1200 // Class.Variable.Public.By Object Function // // Accessing static protected (D) data member by dynamic member function - 1225 // Class.Variable.Protected.By Object Function // // Accessing static private (D) data member by dynamic member function - 1250 // Class.Variable.Private.By Object Function // // // Accessing static public (B) member function wrt class name by client - 1300 // Class.Function.Public.Wrt Class // // Accessing static public (D) member function wrt object by client - 1325 // Class.Function.Public.Wrt Object // // Accessing static protected (D) member function by client - 1350 // Class.Function.Protected.By Client // // Accessing static private (D) member function by client - 1375 // Class.Function.Private.By Client // // // --------------------------------------------------------------------------------- // // COMPOSITION OF CLASSES // // // Called in Composer function, which is in turn called by client // // Accessing public (B) data member by composing class - 2000 // Object.Variable.Public.By Composer // // Accessing protected (D) data member by composing class - 2025 // Object.Variable.Protected.By Composer // // Accessing private (D) data member by composing class - 2050 // Object.Variable.Private.By Composer // // // Called in Composer function, which is in turn called by client // // Accessing public (B) member function by composing class // // Object.Function.Public.By Composer.Function - Expanded below // // Accessing protected (D) member function by composing class - 2100 // Object.Function.Protected.By Composer // // Accessing private (D) member function by composing class - 2125 // Object.Function.Private.By Composer // // // Execution of constructor code (B) by composing class constructor - 2200 // Object.Constructor.By Composer // // Calling constructor with arguments, some of which are used to initialize composed object - 2225 // Object.Initialization.Composed object // // Execution of selectors (B) by composing class function - 2250 // Object.Selector.By Composer // // Execution of mutators (B) by composing class function - 2275 // Object.Mutator.By Composer // // Execution of destructor code (B) by composing class destructor - 2300 // Object.Destructor.By Composer // // // Accessing public (D) data member wrt composing object by client - 2400 // Object.Variable.Public.Wrt Composer // // Accessing protected (D) data member wrt composing object by client - 2425 // Object.Variable.Protected.Wrt Composer // // Accessing private (D) data member wrt composing object by client - 2450 // Object.Variable.Private.Wrt Composer // // // Accessing public (D) member function wrt composing object by client - 2500 // Object.Function.Public.Wrt Composer // // Accessing protected (D) member function wrt composing object by client - 2525 // Object.Function.Protected.Wrt Composer // // Accessing private (D) member function wrt composing object by client - 2550 // Object.Function.Private.Wrt Composer // // Following are for chained dot operator, where operands are both member function calls // Elsewhere, we see chained dot operators, where one operand is a data member // // Object is returned by a function, which is then accessed - 2600 // Object.Returned.By Composer // Calling selector/mutator w.r.t object returned by Composer // // --------------------------------------------------------------------------------- // // PUBLIC INHERITANCE // // // Called in inheritor function, which is in turn called by client // // Accessing public (B) data member by inheriting class - 3000 // Object.Variable.Public.By Inheritor // // Accessing protected (B) data member by inheriting class - 3025 // Object.Variable.Protected.By Inheritor // // Accessing private (D) data member by inheriting class - 3050 // Object.Variable.Private.By Inheritor // // // Called in inheritor function, which is in turn called by client // // Accessing public (B) member function by inheriting class // // Object.Function.Public.By Inheritor.Function - Expanded below // // Accessing protected (B) member function by inheriting class - 3100 // Object.Function.Protected.By Inheritor // // Accessing private (D) member function by inheriting class - 3125 // Object.Function.Private.By Inheritor // // // Accessing public (B) data member wrt inheriting object by client - 3200 // Object.Variable.Public.Wrt Inheritor // // Accessing protected (D) data member wrt inheriting object by client - 3225 // Object.Variable.Protected.Wrt Inheritor // // Accessing private (D) data member wrt inheriting object by client - 3250 // Object.Variable.Private.Wrt Inheritor // // // Accessing public (B) member function wrt inheriting object by client - 3300 // Object.Function.Public.Wrt Inheritor // // Accessing protected (D) member function wrt inheriting object by client - 3325 // Object.Function.Protected.Wrt Inheritor // // Accessing private (D) member function wrt inheriting object by client - 3350 // Object.Function.Private.Wrt Inheritor // // Execution of constructor code (B) when inheriting class's constructor calls it - 3400 // Object.Constructor.Inheritor.Coopted // // Execution of constructor code (B) when inheriting class's constructor does not call it - 3425 // Object.Constructor.Inheritor.Not Coopted // // Constructor is called with arguments, some of which are passed to base class - 3450 // Object.Initialization.Inherited object // // In each problem, call the overridden function wrt BOTH base and derived class object // // Execution of selectors (B) by inheriting class // // Execution of selectors (B) by client wrt inheriting object which overrides it, calls it and behavior is polymorphic - 3500 // Object.Selector.Inheritor.Overridden.Coopted.Polymorphic // // Execution of selectors (B) by client wrt inheriting object which overrides it, does not call it and behavior is polymorphic - 3525 // Object.Selector.Inheritor.Overridden.Not Coopted.Polymorphic // // Execution of selectors (B) by client wrt inheriting object which does not override - 3550 // Object.Selector.Inheritor.Not Overridden // // Execution of selectors (B) by client wrt inheriting object which overrides it, calls it, and behavior is not polymorphic (C++ only) - 3575 // Object.Selector.Inheritor.Overridden.Coopted.NonPolymorphic // // Execution of selectors (B) by client wrt inheriting object which overrides it, does not call it, and behavior is not polymorphic (C++ only) - 3600 // Object.Selector.Inheritor.Overridden.Not Coopted.NonPolymorphic // // // In each problem, call the overridden function wrt both base and derived class object // // Execution of mutators (B) by inheriting class // // Execution of mutators (B) by client wrt inheriting object which overrides it, calls it and behavior is polymorphic - 3700 // Object.Mutator.Inheritor.Overridden.Coopted.Polymorphic // // Execution of mutators (B) by client wrt inheriting object which overrides it, does not call it and behavior is polymorphic - 3725 // Object.Mutator.Inheritor.Overridden.Not Coopted.Polymorphic // // Execution of mutators (B) by client wrt inheriting object which does not override - 3750 // Object.Mutator.Inheritor.Not Overridden // // Execution of mutators (B) by client wrt inheriting object which overrides it, calls it, and behavior is not polymorphic (C++ only) - 3775 // Object.Mutator.Inheritor.Overridden.Coopted.NonPolymorphic // // Execution of mutators (B) by client wrt inheriting object which overrides it, does not call it, and behavior is not polymorphic (C++ only) - 3800 // Object.Mutator.Inheritor.Overridden.Not Coopted.NonPolymorphic // // // Execution of destructor code (B) by inheriting class's destructor - 3850 // Object.Destructor.By Inheritor // // // Assigning base class object to derived class variable - 3900 // Object.Assignment.Aggregate.Assigning base object to derived variable // // Assigning derived class object to base class variable - 3925 // Object.Assignment.Aggregate.Assigning derived object to base variable // // Assigning object of one derived class to variable of another derived class - 3950 // Object.Assignment.Aggregate.Assigning derived object to different derived variable // --------------------------------------------------------------------------------------- // INVERSE OF INHERITANCE // // Called in inheritor function, which is in turn called by client // // Accessing public (B) data member by ancestral class - 4000 // Object.Variable.Public.By Ancestor // // Accessing protected (B) data member by ancestral class - 4025 // Object.Variable.Protected.By Ancestor // // Accessing private (D) data member by ancestral class - 4050 // Object.Variable.Private.By Ancestor // // // Called in inheritor function, which is in turn called by client // // Accessing public (B) member function by ancestral class - 4100 // Object.Function.Public.By Ancestor // // Accessing protected (B) member function by ancestral class - 4125 // Object.Function.Protected.By Ancestor // // Accessing private (D) member function by ancestral class - 4150 // Object.Function.Private.By Ancestor // // // Accessing public (B) data member wrt ancestral object by client - 4200 // Object.Variable.Public.Wrt Ancestor // // Accessing protected (D) data member wrt ancestral object by client - 4225 // Object.Variable.Protected.Wrt Ancestor // // Accessing private (D) data member wrt ancestral object by client - 4250 // Object.Variable.Private.Wrt Ancestor // // // Accessing public (B) member function wrt ancestral object by client - 4300 // Object.Function.Public.Wrt Ancestor // // Accessing protected (D) member function wrt ancestral object by client - 4325 // Object.Function.Protected.Wrt Ancestor // // Accessing private (D) member function wrt ancestral object by client - 4350 // Object.Function.Private.Wrt Ancestor // Notation: // : // 's constructor (last digit is 0) // In client: // = (); // In composing object's constructor: // = (); // In inheriting object's constructor: // (); // Note: is used as return type in the definition so that TemplateParser.isFunctionHeader() // will properly identify constructor as a function // : // 's destructor (last digit is 1) // Note: is used as return type in the definition so that TemplateParser.isFunctionHeader() // will properly identify destructor as a function // : // 's 's selector (last digit is 0) (Note: may be inherited from 's parent!) // In client: // << .(); // In inheriting object's selector (assuming inherited from ): // return (); // Note: Selector's name is not logged in SymbolTable // : // 's 's mutator (last digit is 1) (Note: may be inherited from 's parent!) // Note: Mutator's name is not logged in SymbolTable // Say is the parent and inherits from it // is defined in and overridden in // In .() definition, (); would be a recursive call. // How do we call 's ()? // <*1>.()? // .()? // ()? // ()? // --------------------------------------------------------------------------------- // Each problem tests wrt some client code that accesses the data member of member function in question // In the following, (B) stands for behavior/output, (D) for debug // ================================================================================= // // VARIABLES AND FUNCTIONS OF AN OBJECT // --------------------------------------------------------------------------------- // // Accessing public (B) data member by client - 100 // Object.Variable.Public.By Client # 100 OOP.Object.Variable.Public.By Client > {{ public: ; (){return ;} (){=;} protected: private: } (){ = (); . = ; << .; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (D) data member by client - 125 // Object.Variable.Protected.By Client // Object.Variable.Protected.The variable is protected in the class and cannot be accessed // Old: Client code does not have access to protected data member of the object # 125 OOP.Object.Variable.Protected.The variable is protected in the class and cannot be accessed > {{ public: (){return - 10;} (){if( > 0) = + 10; else = 10;} protected: ; private: } (){ = (); . = ; = ; << ; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) data member by client - 150 // Object.Variable.Private.By Client // Object.Variable.Private.The variable is private in the class and cannot be accessed // Old: Client code does not have access to private data member of the object # 150 OOP.Object.Variable.Private.The variable is private in the class and cannot be accessed > {{ public: (){return / 2;} (){= * 10;} protected: private: ; } (){ = ; = (); . = ; << ; }} > Type: debug_output Hardness: 10 // ================================================================================= // // All functions public // --------------------------------------------------------------------------------- // // Accessing public (B) data member by dynamic member function - 200 // Object.Variable.Public.By Object Function # 200 OOP.Object.Variable.Public.By Object Function > {{ public: (){return ;} (){if( >= 0){ =;} else { = 1;}} ; protected: private: } (){ = (); . = ; << .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (B) data member by dynamic member function - 225 // Object.Variable.Protected.By Object Function # 225 OOP.Object.Variable.Protected.By Object Function > {{ public: (){return ;} (){ = ; << ;} protected: ; private: } (){ = (); .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (B) data member by dynamic member function - 250 // Object.Variable.Private.By Object Function # 250 OOP.Object.Variable.Private.By Object Function > {{ public: (){return ;} (){ = ; << ;} protected: private: ; } (){ = ; = (); .(); << ; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing public (D) data member by static member function - 300 // // Accessing protected (D) data member by static member function // // Accessing private (D) data member by static member function // Object.Variable.Public.By Class Function // Object.Variable.Protected.By Class Function // Object.Variable.Private.By Class Function // Object.Variable.Public.Class (static) function does not have access to public data member of the object // Object.Variable.Protected.Class (static) function does not have access to protected data member of the object // Object.Variable.Private.Class (static) function does not have access to private data member of the object # 300 OOP.Object.Variable.The variable is not a static member of the class and cannot be accessed in a static function > {{ public: static (){ = ;} ; protected: private: } (){ = .(); .(); }} > Type: debug_output Hardness: 10 # 301 OOP.Object.Variable.The variable is not a static member of the class and cannot be accessed in a static function > {{ public: static (){;>> ;>> ;<< - 10;} protected: ; private: } (){ = (); .(); }} > Input: "\n\n" > Type: debug_output Hardness: 10 # 302 OOP.Object.Variable.The variable is not a static member of the class and cannot be accessed in a static function > {{ public: static (){; = ; = ;} protected: private: ; } (){ = (); .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing dynamic data member with respect to the class - 325 # 325 OOP.Object.Variable.The variable is not a static member of the class and cannot be accessed with respect to the class > {{ public: // (){ = ;<< ;} (){ = ;<< ;} ; protected: private: } (){ = (); . = 0; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (D) member function by client - 400 // Object.Function.Protected.By Client // Object.Function.Protected.The function is protected in the class and cannot be called // Old: Client code does not have access to protected member function of the object # 400 OOP.Object.Function.Protected.The function is protected in the class and cannot be called > {{ public: (){ = ; return ;} protected: (){ = ; << ;} private: } (){ = ; = (); .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) member function by client - 425 // Object.Function.Private.By Client // Object.Function.Private.The function is private in the class and cannot be called // Old: Client code does not have access to private member function of the object # 425 OOP.Object.Function.Private.The function is private in the class and cannot be called > {{ public: protected: (){ = ; << ;} private: (){ = ; return ;} } (){ = ; = (); .(); }} > Type: debug_output Hardness: 10 // ================================================================================= // // All public member functions // --------------------------------------------------------------------------------- // // Execution of constructor code (B) wrt object - 500 // Object.Constructor.By Client # 500 OOP.Object.Constructor.By Client ? Object.Variable.Public.By Object Function > {{ public: (){ = ;<< ;} ; protected: private: } (){ = (); = ; << ; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of constructor with one or more parameters - 525 // Object.Initialization.Basic object # 525 OOP.Object.Initialization.Basic object ? Object.{Constructor.By Client,Variable.Public.By Object Function} > {{ public: (){ = ;<< ;<< ;} ; protected: private: } (){ = ( ); }} > Type: debug_output Hardness: 10 # 526 OOP.Object.Initialization.Basic object ? Object.{Constructor.By Client,Variable.Public.By Object Function} > {{ public: (){<< ; = * 10;<< ;} ; protected: private: } (){ = 0; >> ; = ( ); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of constructor with incorrect number of parameters - 550 // Object.Constructor.Number of actual parameters in the call not equal to the number of formal parameters in the definition // 0-1, 1-2, 2-1 # 550 OOP.Object.Constructor.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {{ public: (){ = ;<< ;} ; protected: private: } (){ = ( ); }} > Type: debug_output Hardness: 10 # 551 OOP.Object.Constructor.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {{ public: (){if( % 2 == 0 ){ = * 10;} else { = + 10;} << ;} ; protected: private: } (){ ; >> ; ; >> ; = ( , ); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 # 552 OOP.Object.Constructor.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {{ public: (, ){if( < ){ = ;} else { = ;} << ;} ; protected: private: } (){ = ; = ( ); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of constructor with incorrect data types for parameters - 575 // Object.Constructor.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition # 575 OOP.Object.Constructor.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {{ public: (){ = * 10;<< ;} ; protected: private: } (){ = ; = ( ); }} > Type: debug_output Hardness: 10 # 576 OOP.Object.Constructor.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {{ public: (, ){if( < ){ = * 2;} else { = / 2;} << ;} ; protected: private: } (){ = ; = ; = ( , ); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of selectors (B) wrt object - 600 // Object.Selector.By Client # 600 OOP.Object.Selector.By Client ? Object.{Constructor.By Client,Variable.Public.By Object Function} > {{ public: (){ = ;<< ; return ;} ; protected: private: } (){ = (); ; = .(); = * 10; << ; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Value returned by the selector is ignored by the caller - 625 // Object.Selector.Value returned by the function is ignored by the caller # 625 OOP.Object.Selector.Value returned by the function is ignored by the caller > {{ public: (){ = ;<< ; return ;} ; protected: private: } (){ = (); .(); }} > Type: debug_output Hardness: 10 # 626 OOP.Object.Selector.Value returned by the function is ignored by the caller > {{ public: (){ = ;if( < 5.0 ){ << ;} else { << - 5.0;} return * 2;} ; protected: private: } (){ = (); .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Selector is called before data member is initialized - 650 // Object.Selector.Referencing variable before initializing its value // Java compiler initializes value to zero anyway - do not use for Java # 650 OOP.Object.Selector.Referencing variable before initializing its value ? Object.Variable.Public.By Object Function > {{ public: (){<< ;} ; protected: private: } (){ = (); .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of mutators (B) wrt object - 700 // Object.Mutator.By Client # 700 OOP.Object.Mutator.By Client ? Object.Variable.Public.By Object Function > {{ public: (){ = ; = * 10; << ;} ; protected: private: } (){ = ; = (); .( ); << ; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Value returned by the mutator is ignored by the caller - 725 // Object.Mutator.Value returned by the function is ignored by the caller # 725 OOP.Object.Mutator.Value returned by the function is ignored by the caller > {{ public: (){if( >= 0){ = ; << ; return true;} else { = * -1; << ;return false;}} ; protected: private: } (){ = ; = (); .( ); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Mutator is called with incorrect number of parameters - 750 // Object.Mutator.Number of actual parameters in the call not equal to the number of formal parameters in the definition // 1-0, 2-1, 1-2 # 750 OOP.Object.Mutator.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {{ public: (){ = ; = * 10; << ;} ; protected: private: } (){ = (); .(); }} > Type: debug_output Hardness: 10 # 751 OOP.Object.Mutator.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {{ public: (){if( > 0 ) { = ;} else { = * -1;} << ;} ; protected: private: } (){ = ; = (); .( , ); }} > Type: debug_output Hardness: 10 # 752 OOP.Object.Mutator.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {{ public: (, ){if( > ) { = - ;} else { = - ;} << ;} ; protected: private: } (){ = ; = (); .( ); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Mutator is called with incorrect data type for parameters - 775 // Object.Mutator.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition # 775 OOP.Object.Mutator.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {{ public: (){ = * ; << ;} ; protected: private: } (){ = ; = (); .( ); }} > Type: debug_output Hardness: 10 # 776 OOP.Object.Mutator.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {{ public: (, ){if( > ) { = - ;} else { = - ;} << ;} ; protected: private: } (){ = ; = ; = (); .( , ); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of destructor code (B) wrt object - 800 // Object.Destructor.By Client # 800 OOP.Object.Destructor.By Client > {{ public: (){<< ;<< ;} protected: private: ; } (){ = (); = ; << ; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Assigning an object to class instead of another object - 900 // Object.Assignment.Aggregate.Assigning to class // Object.Assignment.Aggregate.Object cannot be assigned to a class # 900 OOP.Object.Assignment.Aggregate.Object cannot be assigned to a class > {{ public: (){ = ;<< ;} ; protected: private: } (){ = (); << ; }} > Type: debug_output Hardness: 10 # 901 OOP.Object.Assignment.Aggregate.Object cannot be assigned to a class > {{ public: (){>> ; = * 10;<< ;} ; protected: private: } (){ = (); ; >> ; = * ; << ; }} > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Aggregate assignment from one object to another - 925 // Object.Assignment.Aggregate.Assigning object to variable # 925 OOP.Object.Assignment.Aggregate.Assigning object to variable ? Object.{Constructor.By Client,Variable.Public.By Object Function,Selector.By Client} > {{ public: (){>> ;<< ;} (){return ;} ; protected: private: } (){ = (); = (); = ; << .(); }} > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Object passed as parameter to a function where it is accessed - 950 // Object.Parameter.Aggregate.Accessed # 950 OOP.Object.Parameter.Aggregate.Accessed ? Object.Variable.Public.By Client > {{ public: ; protected: private: } (){ << .; } (){ = (); . = ; ( ); << .; }} > Type: debug_output Hardness: 10 # 960 OOP.Object.Parameter.Aggregate.Accessed ? Object.{Constructor.By Client,Selector.By Client,Mutator.By Client,Variable.Public.By Object Function} > {{ public: (){ = ;} (){return ;} (){>> ;} ; protected: private: } (){ << .(); } (){ = (); .(); ( ); << .(); }} > Input: "\n\n" > Type: debug_output Hardness: 20 // --------------------------------------------------------------------------------- // // Object passed as parameter to a function where it is modified - 975 // Object.Parameter.Aggregate.Modified # 975 OOP.Object.Parameter.Aggregate.Modified ? Object.Variable.Public.By Client > {{ public: ; protected: private: } (){ . = ; << .; } (){ = (); . = ; ( ); << .; }} > Type: debug_output Hardness: 10 # 985 OOP.Object.Parameter.Aggregate.Modified ? Object.{Constructor.By Client,Selector.By Client,Mutator.By Client,Variable.Public.By Object Function} > {{ public: (){ = ;} (){return ;} (){>> ;} ; protected: private: } (){ .(); << .(); } (){ = (); ( ); << .(); }} > Input: "\n\n" > Type: debug_output Hardness: 20 // ================================================================================= // // STATIC VARIABLE AND FUNCTION IN A CLASS // --------------------------------------------------------------------------------- // // Accessing static public (B) data member by client - 1000 // Class.Variable.Public.Wrt Class # 1000 OOP.Class.Variable.Public.Wrt Class > {{ public: static ; (){>> ;<< ;} protected: private: ; } (){ . = ; << .; }} > Input: "\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static public (B) data member by client - 1025 // Class.Variable.Public.Wrt Object # 1025 OOP.Class.Variable.Public.Wrt Object > {{ public: (){>> ;<< ;} static ; protected: private: ; } (){ = (); .(); >> .; }} > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static protected (D) data member by client - 1050 // Class.Variable.Protected.By Client # 1050 OOP.Class.Variable.Protected.By Client > {{ public: (){ = ;<< ;} protected: static ; private: ; } (){ = (); . = ; .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static private (D) data member by client - 1075 // Class.Variable.Private.By Client # 1075 OOP.Class.Variable.Private.By Client > {{ public: (){>> ;<< + 1;>> ;<< - 1;} protected: private: ; static ; } (){ = (); >> .; .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static public (B) data member by static member function - 1100 // Class.Variable.Public.By Class Function # 1100 OOP.Class.Variable.Public.By Class Function ? Class.Function.Public.Wrt Class > {{ public: static (){ = ;return ;} static ; protected: private: } (){ << .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static protected (B) data member by static member function - 1125 // Class.Variable.Protected.By Class Function # 1125 OOP.Class.Variable.Protected.By Class Function ? Class.Function.Public.Wrt Class > {{ public: static (){>> ;<< ;>> ;return ;} protected: static ; private: } (){ = (); << .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static private (B) data member by static member function - 1150 // Class.Variable.Private.By Class Function # 1150 OOP.Class.Variable.Private.By Class Function ? Class.Function.Public.Wrt Class > {{ public: static (){>> ; = * 10;<< ;} protected: private: static ; } (){ = (); .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static public (D) data member by dynamic member function - 1200 // Class.Variable.Public.By Object Function # 1200 OOP.Class.Variable.Public.By Object Function > {{ public: (){ = ; = * 10;return ;} static ; protected: private: } (){ = (); << .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static protected (D) data member by dynamic member function - 1225 // Class.Variable.Protected.By Object Function # 1225 OOP.Class.Variable.Protected.By Object Function > {{ public: (){>> ; = + 10;return ;} protected: static ; private: } (){ = (); << .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static private (D) data member by dynamic member function - 1250 // Class.Variable.Private.By Object Function # 1250 OOP.Class.Variable.Private.By Object Function > {{ public: (){>> ; = + 1;return ;} protected: private: static ; } (){ = (); << .(); << .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static public (B) member function wrt class name by client - 1300 // Class.Function.Public.Wrt Class # 1300 OOP.Class.Function.Public.Wrt Class > {{ public: static (){ = ; = * 10;<< ;} (){ = ;} protected: private: ; } (){ = (); .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static public (D) member function wrt object by client - 1325 // Class.Function.Public.Wrt Object # 1325 OOP.Class.Function.Public.Wrt Object > {{ public: static (){ = ; = + 10;<< ;} (){ = ; = - 10; << ;} protected: private: ; } (){ = (); .( ); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static protected (D) member function by client - 1350 // Class.Function.Protected.By Client # 1350 OOP.Class.Function.Protected.By Client > {{ public: (){ = ;} protected: static (){;>> ; = * 10;<< ;>> ; = + 10;<< ;} private: ; } (){ = (); .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing static private (D) member function by client - 1375 // Class.Function.Private.By Client # 1375 OOP.Class.Function.Private.By Client > {{ public: (){ = ;} protected: ; private: static (){;>> ; = + ;<< ;>> ; = - ;<< ;} } (){ = (); .( ); }} > Input: "\n\n" > Type: debug_output Hardness: 10 // ================================================================================= // // COMPOSITION OF CLASSES // // Called in Composer function, which is in turn called by client // --------------------------------------------------------------------------------- // // Accessing public (B) data member by composing class - 2000 // Object.Variable.Public.By Composer // ***Technically synonymous with*** Object.Variable.Public.By Client # 2000 OOP.Object.Variable.Public.By Composer ? OOP.Object.Variable.Public.By Object Function > {{ public: ; protected: (){=;return ;} private: } { public: (){ = ();} (){>> .;.++;<< .;} ; protected: private: } (){ = (); .(); }} > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (D) data member by composing class - 2025 // Object.Variable.Protected.By Composer // ***Technically synonymous with*** Object.Variable.Protected.By Client # 2025 OOP.Object.Variable.Protected.By Composer ? OOP.Object.Variable.Protected.By Object Function > {{ public: (){=;return ;} protected: ; private: } { public: (){ = ;.=;<< ;} (){ = ();} protected: ; private: } (){ = (); .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) data member by composing class - 2050 // Object.Variable.Private.By Composer // ***Technically synonymous with*** Object.Variable.Private.By Client # 2050 OOP.Object.Variable.Private.By Composer ? OOP.Object.Variable.Private.By Object Function > {{ public: (){=;return ;} protected: private: ; } { public: (){. = ;<< ;} (){ = ();} protected: private: ; } (){ = ; = (); .(); }} > Type: debug_output Hardness: 10 // // Called in Composer function, which is in turn called by client // --------------------------------------------------------------------------------- // // Accessing protected (D) member function by composing class - 2100 // Object.Function.Protected.By Composer // ***Technically synonymous with*** Object.Function.Protected.By Client # 2100 OOP.Object.Function.Protected.By Composer ? OOP.Object.Variable.Protected.By Object Function > {{ public: protected: (){>> ; = + 10;<< ;} ; private: } { public: (){;.(); >> ; << ;} (){ = ();} protected: ; private: } (){ = (); .(); }} > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) member function by composing class - 2125 // Object.Function.Private.By Composer // ***Technically synonymous with*** Object.Function.Private.By Client # 2125 OOP.Object.Function.Private.By Composer ? OOP.Object.Variable.Private.By Object Function > {{ public: protected: private: (){ = ;<< ;} ; } { public: (){.(); << ;} (){ = ();} protected: private: ; } (){ = ; = (); .( ); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of constructor code (B) by composing class constructor - 2200 // Object.Constructor.By Composer # 2200 OOP.Object.Constructor.By Composer ? OOP.Object.Variable.Private.By Object Function > {{ public: (){ = ;<< ;} protected: private: } { public: (){ = (); = ;<< ;} protected: private: ; } (){ = ; = (); << ; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Calling constructor with arguments, some of which are used to initialize composed object - 2225 // Object.Initialization.Composed object # 2225 OOP.Object.Initialization.Composed object ? OOP.Object.{Initialization.Basic object,Variable.Private.By Object Function} > {{ public: (){ = ;<< ;} protected: private: ; } { public: (,){=(); = ;<< ;} protected: private: ; ; } (){ = ( , ); }} > Type: debug_output Hardness: 10 # 2226 OOP.Object.Initialization.Composed object ? OOP.Object.{Initialization.Basic object,Variable.Protected.By Object Function} > {{ public: (){ = ;<< ;} protected: ; private: } { public: (,){ = ;=();<< ;} protected: ; ; private: } (){ ; >> ; ; >> ; = ( , ); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of selectors (B) by composing class function - 2250 // Object.Selector.By Composer # 2250 OOP.Object.Selector.By Composer ? OOP.Object.Variable.Public.By Object Function > {{ public: (){ = ;<< ; = + 1; return ;} ; protected: private: } { public: (){ = ();} (){ = .();<< ;} ; protected: private: } (){ = (); .(); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of mutators (B) by composing class function - 2275 // Object.Mutator.By Composer # 2275 OOP.Object.Mutator.By Composer ? OOP.Object.Variable.Protected.By Object Function > {{ public: ( ){ = ;<< ;} protected: ; private: } { public: (){ = ();} ( ){.( ); = + 10;<< ;} protected: ; private: } (){ = (); = ; .( ); }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of destructor code (B) by composing class destructor - 2300 // Object.Destructor.By Composer # 2300 OOP.Object.Destructor.By Composer ? OOP.Object.Variable.Protected.By Object Function > {{ public: (){ = ;<< ;} protected: private: } { public: (){ = ();} (){ = ;<< ;} protected: ; private: } (){ = ; { = (); = - 10; } = + 1; }} > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing public (D) data member wrt composing object by client - 2400 // Object.Variable.Public.Wrt Composer # 2400 OOP.Object.Variable.Public.Wrt Composer ? OOP.Object.Variable.Public.By Client > {{ public: ( ){ = % 2;<< ;} ; protected: private: } { public: (){ = ();} (){ = ;<< / 2;return ;} ; protected: private: ; } (){ = (); .. = ; << ..; }} > Type: debug_output Hardness: 10 # 2401 OOP.Object.Variable.Public.Wrt Composer > {{ public: (){>> ;<< ;return ;} ; protected: private: } { public: (){ = ();} (){ = .(); = * ;<< ;} ; protected: private: ; } (){ = (); . = ; << .(); }} > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (D) data member wrt composing object by client - 2425 // Object.Variable.Protected.Wrt Composer # 2425 OOP.Object.Variable.Protected.Wrt Composer > {{ public: (){ = ; = * 2;return ;} protected: ; private: } { public: ( ){ = / 2; = * 10;<< ;} (){ = ();} ; protected: private: ; } (){ = (); = ; .. = ; << ; }} > Type: debug_output Hardness: 10 # 2426 OOP.Object.Variable.Protected.Wrt Composer > {{ public: (){>> ; = * 2;return ;} protected: ; private: } { public: ( ){<< ; << .(); << + .();} (){ = ();} ; protected: private: } (){ = (); >> .; }} > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) data member wrt composing object by client - 2450 // Object.Variable.Private.Wrt Composer # 2450 OOP.Object.Variable.Private.Wrt Composer > {{ public: (){ = ;<< ;return ;} protected: private: ; } { public: (){ = .(); = * 10;<< ;} (){ = ();} ; protected: private: } (){ ; = (); >> ..; >> ; << ; }} > Input: "\n\n" > Type: debug_output Hardness: 10 # 2451 OOP.Object.Variable.Private.Wrt Composer > {{ public: (){>> ; = * 10;return ;} protected: private: ; } { public: (){<< .();<< .();} (){ = ();} ; protected: private: } (){ = (); >> .; .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing public (D) member function wrt composing object by client - 2500 // Object.Function.Public.Wrt Composer # 2500 OOP.Object.Function.Public.Wrt Composer ? OOP.Object.Variable.Public.By Client > {{ public: (){ = ; << ; << + 1;} protected: private: } { public: (){ = ();} (){ = ;<< ;<< - 1;} ; protected: private: ; } (){ = (); ..(); }} > Type: debug_output Hardness: 10 # 2501 OOP.Object.Function.Public.Wrt Composer > {{ public: (){; >> ;<< ;<< * 10;} protected: private: } { public: (){ = ();} (){.();.();} ; protected: private: } (){ = (); .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (D) member function wrt composing object by client - 2525 // Object.Function.Protected.Wrt Composer # 2525 OOP.Object.Function.Protected.Wrt Composer > {{ public: protected: (){ = ; if( % 2 == 0 ) << ; else << - 1;} private: } { public: (){ = ();} ; protected: (){ = .();if( > 5 ) << - 1;else << + 1;} private: } (){ = (); << ..(); }} > Type: debug_output Hardness: 10 # 2526 OOP.Object.Function.Protected.Wrt Composer > {{ public: protected: (){ do{ >> ; }while( % 2 == 0 ); << ;} private: ; } { public: (){ = ();} ; protected: (){; do{ >> ; }while( < 10 ); << ;} private: } (){ = (); .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) member function wrt composing object by client - 2550 // Object.Function.Private.Wrt Composer // # 2550 OOP.Object.Function.Private.Wrt Composer > {{ public: ; protected: private: ( ){if( >= 0 ) { = ;} else = 0;<< ;} } { public: (){ = ();} ; protected: ( ){ = ; if( <= 5 ){ = * 2;} = ; << ;} private: } (){ = (); ..( ); }} > Type: debug_output Hardness: 10 # 2551 OOP.Object.Function.Private.Wrt Composer > {{ public: ; protected: private: (){do{ >> ;} while( < 10 ); << ;} } { public: (){ = ();} ; protected: ( ){; do{ >> ;} while( < );return ;} private: } (){ = (); .(); }} > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Object is returned by a function, which is then accessed - 2600 // Object.Returned.By Composer // Calling selector/mutator w.r.t object returned by Composer // This learning objective is about chaining dot operator more than anything else.. # 2600 OOP.Object.Returned.By Composer ? OOP.Object.{Constructor.By Client,Selector.By Client,Variable.Protected.By Object Function} > {{ public: (){ = ;} (){ return ; } protected: ; private: } { public: (){=(); = ;} (){ return ; } protected: ; ; private: } (){ = (); << .().(); }} > Type: debug_output Hardness: 10 # 2601 OOP.Object.Returned.By Composer ? OOP.Object.{Constructor.By Client,Mutator.By Client,Variable.Private.By Object Function} > {{ public: (){ = ;} (){ = ; << ;} protected: private: ; } { public: (){=(); = ;} (){ return ; } protected: private: ; ; } (){ = (); .().( ); }} > Type: debug_output Hardness: 10 // ================================================================================= // // PUBLIC INHERITANCE // // --------------------------------------------------------------------------------- // // Called in inheritor function, which is in turn called by client // --------------------------------------------------------------------------------- // // Accessing public (B) data member by inheriting class - 3000 // Object.Variable.Public.By Inheritor # 3000 OOP.Object.Variable.Public.By Inheritor > {{ public: (){=;return ;} ; protected: private: } : public { public: (){=;<< ;} protected: private: } (){ = (); .();} } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (B) data member by inheriting class - 3025 // Object.Variable.Protected.By Inheritor # 3025 OOP.Object.Variable.Protected.By Inheritor > {{ public: (){=;return ;} protected: ; private: } : public { public: (){>> ; = + 1;<< ;} protected: private: } (){ = (); .();} } > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) data member by inheriting class - 3050 // Object.Variable.Private.By Inheritor # 3050 OOP.Object.Variable.Private.By Inheritor > {{ public: (){=;return ;} protected: private: ; } : public { public: (){ = ;<< ; = ;} protected: private: } (){ = (); .();} } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (B) member function by inheriting class - 3100 // Object.Function.Protected.By Inheritor # 3100 OOP.Object.Function.Protected.By Inheritor > {{ public: protected: (){;>> ;<< ;} private: } : public { public: (){<< ;();} protected: private: } (){ = ; = (); .( );} } > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) member function by inheriting class - 3125 // Object.Function.Private.By Inheritor # 3125 OOP.Object.Function.Private.By Inheritor > {{ public: protected: private: (){ = * 2;<< ;} } : public { public: (){ = ;<< ;();} protected: private: } (){ = (); .();} } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing public (B) data member wrt inheriting object by client - 3200 // Object.Variable.Public.Wrt Inheritor # 3200 OOP.Object.Variable.Public.Wrt Inheritor > {{ public: (){;>> ;<< ;return ;} ; protected: private: } : public { public: (){<< ; = + 1;<< ;} protected: private: } (){ = ; = (); . = ; << ;} } > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (D) data member wrt inheriting object by client - 3225 // Object.Variable.Protected.Wrt Inheritor # 3225 OOP.Object.Variable.Protected.Wrt Inheritor > {{ public: (){>> ;<< ;return ;} protected: ; private: } : public { public: (){ = ; = / 10;<< ;} protected: private: } (){ = (); . = ; .();} } > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) data member wrt inheriting object by client - 3250 // Object.Variable.Private.Wrt Inheritor # 3250 OOP.Object.Variable.Private.Wrt Inheritor > {{ public: (){if( > 0) = ; else = 0;} protected: private: ; } : public { public: (){;>> ;return ;} protected: private: } (){ = (); >> .; << .();} } > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing public (B) member function wrt inheriting object by client - 3300 // Object.Function.Public.Wrt Inheritor # 3300 OOP.Object.Function.Public.Wrt Inheritor > {{ public: (){ = ; << ;} protected: private: } : public { public: (){;>> ;return ;} protected: private: } (){ = ; = (); .(); << ;} } > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (D) member function wrt inheriting object by client - 3325 // Object.Function.Protected.Wrt Inheritor # 3325 OOP.Object.Function.Protected.Wrt Inheritor > {{ public: protected: (){;>> ; return ;} private: } : public { public: (){; = () + ();<< ;} protected: private: } (){ = (); << .();} } > Input: "\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) member function wrt inheriting object by client - 3350 // Object.Function.Private.Wrt Inheritor # 3350 OOP.Object.Function.Private.Wrt Inheritor > {{ public: protected: private: (){<< - 1; << ; << + 1;} } : public { public: (){<< / 2; << % 2;} protected: private: } (){ = (); .( ); .( );} } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of constructor code (B) when inheriting class's constructor calls it - 3400 // Object.Constructor.Inheritor.Coopted # 3400 OOP.Object.Constructor.Inheritor.Coopted ? OOP.Object.Variable.Public.By Object Function > {{ public: (){ = ;<< ;} ; protected: private: } : public { public: (){(); = ;<< ;} ; protected: private: } (){ = (); = ; << ; } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of constructor code (B) when inheriting class's constructor does not call it - 3425 // Object.Constructor.Inheritor.Not Coopted # 3425 OOP.Object.Constructor.Inheritor.Not Coopted ? OOP.Object.Variable.Public.By Object Function > {{ public: (){ = ;<< ;<< - 1;} ; protected: private: } : public { public: (){ = ;<< ;<< + 1;} ; protected: private: } (){ = ; = (); << ; } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Constructor is called with arguments, some of which are passed to base class - 3450 // Object.Initialization.Inherited object # 3450 OOP.Object.Initialization.Inherited object ? OOP.Object.{Initialization.Basic object,Variable.Protected.By Object Function} > {{ public: (){ = ;<< ;} protected: ; private: } : public { public: (, ){(); = ;<< ;} protected: ; private: } (){ = ; = ; = ( , ); } > Type: debug_output Hardness: 10 # 3451 OOP.Object.Initialization.Inherited object ? OOP.Object.{Initialization.Basic object,Variable.Private.By Object Function} > {{ public: (){ = ; = + 1;<< ;} protected: private: ; } : public { public: (, ){(); = ; = - 1;<< ;} protected: private: ; } (){ ; >> ; ; >> ; = ( , ); } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // ================================================================================= // // In each problem, call the overridden function wrt BOTH base and derived class object // // Execution of selectors (B) by inheriting class // --------------------------------------------------------------------------------- // // Execution of selectors (B) by client wrt inheriting object which overrides it, calls it and behavior is polymorphic - 3500 // Object.Selector.Inheritor.Overridden.Coopted.Polymorphic # 3500 OOP.Object.Selector.Inheritor.Overridden.Coopted.Polymorphic ? OOP.Object.{Variable.Public.By Object Function,Assignment.Aggregate.Assigning derived object to base variable} > {{ public: virtual (){ = ;<< ;return ;} ; protected: private: } : public { public: (){ = .(); = * 10;<< ;return ;} protected: private: } (){ = (); = .(); << ; = (); = .(); << ; } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of selectors (B) by client wrt inheriting object which overrides it, does not call it and behavior is polymorphic - 3525 // Object.Selector.Inheritor.Overridden.Not Coopted.Polymorphic # 3525 OOP.Object.Selector.Inheritor.Overridden.Not Coopted.Polymorphic ? OOP.Object.{Variable.Public.{By Inheritor,By Object Function},Assignment.Aggregate.Assigning derived object to base variable} > {{ public: virtual (){ = ;<< ;return ;} ; protected: private: } : public { public: (){ = ;<< ;return ;} protected: private: } (){ = (); = .(); << ; = (); = .(); << ; } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of selectors (B) by client wrt inheriting object which does not override - 3550 // Object.Selector.Inheritor.Not Overridden # 3550 OOP.Object.Selector.Inheritor.Not Overridden ? OOP.Object.Variable.Public.By Object Function > {{ public: virtual (){ = ;<< ;return ;} ; protected: private: } : public { public: (){ = + ;<< ;return ;} protected: private: } (){ = (); = .(); << ; = (); = .(); << ; } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of selectors (B) by client wrt inheriting object which overrides it, calls it, and behavior is not polymorphic (C++ only) - 3575 // Object.Selector.Inheritor.Overridden.Coopted.NonPolymorphic # 3575 OOP.Object.Selector.Inheritor.Overridden.Coopted.NonPolymorphic ? OOP.Object.{Variable.Public.By Object Function,Assignment.Aggregate.Assigning derived object to base variable} > {{ public: (){>> ;<< ;return ;} ; protected: private: } : public { public: (){ = .();>> ;<< ; return - ;} ; protected: private: } (){ = (); << .(); = (); << .(); } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of selectors (B) by client wrt inheriting object which overrides it, does not call it, and behavior is not polymorphic (C++ only) - 3600 // Object.Selector.Inheritor.Overridden.Not Coopted.NonPolymorphic # 3600 OOP.Object.Selector.Inheritor.Overridden.Not Coopted.NonPolymorphic ? OOP.Object.{Variable.Public.By Object Function,Assignment.Aggregate.Assigning derived object to base variable} > {{ public: (){>> ; if( < ){ = + 1; } << ;return ;} ; protected: private: } : public { public: (){>> ; if( > ){ = - 1; } << ;return ;} ; protected: private: } (){ = (); << .(); = (); << .(); } > Type: debug_output Hardness: 10 // ================================================================================= // // In each problem, call the overridden function wrt both base and derived class object // // Execution of mutators (B) by inheriting class // --------------------------------------------------------------------------------- // // Execution of mutators (B) by client wrt inheriting object which overrides it, calls it and behavior is polymorphic - 3700 // Object.Mutator.Inheritor.Overridden.Coopted.Polymorphic # 3700 OOP.Object.Mutator.Inheritor.Overridden.Coopted.Polymorphic ? OOP.Object.{Variable.Public.By Object Function,Assignment.Aggregate.Assigning derived object to base variable} > {{ public: virtual (){ = ;<< ;} ; protected: private: } : public { public: (){.(); = * 10; << ;} protected: private: } (){ = (); .( ); = (); .( ); } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of mutators (B) by client wrt inheriting object which overrides it, does not call it and behavior is polymorphic - 3725 // Object.Mutator.Inheritor.Overridden.Not Coopted.Polymorphic # 3725 OOP.Object.Mutator.Inheritor.Overridden.Not Coopted.Polymorphic ? OOP.Object.{Variable.Public.{By Object Function,By Inheritor},Assignment.Aggregate.Assigning derived object to base variable} > {{ public: virtual (){ = + 1;<< ;} ; protected: private: } : public { public: (){ = - 1; << ;} protected: private: } (){ = (); .( ); = (); .( ); } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of mutators (B) by client wrt inheriting object which does not override - 3750 // Object.Mutator.Inheritor.Not Overridden # 3750 OOP.Object.Mutator.Inheritor.Not Overridden ? OOP.Object.Variable.Public.By Object Function > {{ public: virtual (){ = + 10;<< ;} ; protected: private: } : public { public: (,){ = + ; << ;} protected: private: } (){ = (); = ; .( ); = (); = ; .( ); } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of mutators (B) by client wrt inheriting object which overrides it, calls it, and behavior is not polymorphic (C++ only) - 3775 // Object.Mutator.Inheritor.Overridden.Coopted.NonPolymorphic # 3775 OOP.Object.Mutator.Inheritor.Overridden.Coopted.NonPolymorphic ? OOP.Object.{Variable.Public.By Object Function,Assignment.Aggregate.Assigning derived object to base variable} > {{ public: (){ = * 10; = ;<< ;} ; protected: private: } : public { public: (){ = + 10;.();<< ;} protected: private: } (){ ; = (); >> ; .( ); = (); >> ; .( ); } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of mutators (B) by client wrt inheriting object which overrides it, does not call it, and behavior is not polymorphic (C++ only) - 3800 // Object.Mutator.Inheritor.Overridden.Not Coopted.NonPolymorphic # 3800 OOP.Object.Mutator.Inheritor.Overridden.Not Coopted.NonPolymorphic ? OOP.Object.{Variable.Public.By Object Function,Assignment.Aggregate.Assigning derived object to base variable} > {{ public: (){ = + 1;<< ;} ; protected: private: } : public { public: (){<< ; = - 1; << ;} protected: private: } (){ ; >> ; = (); .( ); = (); .( ); } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Execution of destructor code (B) when inheriting class's destructor calls it - 3850 // Object.Destructor.By Inheritor # 3850 OOP.Object.Destructor.By Inheritor ? OOP.Object.Variable.Public.By Object Function > {{ public: (){ = ;<< ;} ; protected: private: } : public { public: (){(); = ;<< ;} ; protected: private: } (){ = (); = ; << ; } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Assigning base class object to derived class variable - 3900 // Object.Assignment.Aggregate.Assigning base object to derived variable # 3900 OOP.Object.Assignment.Aggregate.Assigning base object to derived variable > {{ public: (){ = ;<< ;} protected: private: ; } : public { public: (){(); = R2#6<=R2<=9;#>;<< ;} protected: private: ; } (){ = (); } > Type: debug_output Hardness: 10 # 3901 OOP.Object.Assignment.Aggregate.Assigning base object to derived variable > {{ public: (){>> ;<< ;} protected: ; private: } : public { public: (){();>> ;<< ;} protected: ; private: } (){ = (); } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Assigning derived class object to base class variable - 3925 // Object.Assignment.Aggregate.Assigning derived object to base variable # 3925 OOP.Object.Assignment.Aggregate.Assigning derived object to base variable ? OOP.Object.{Variable.Protected.By Object Function,Constructor.By Client,Constructor.Inheritor.Coopted} > {{ public: (){ = ;<< ;} protected: ; private: } : public { public: (){(); = R2#6<=R2<=9;#>;<< ;} protected: ; private: } (){ = (); } > Type: debug_output Hardness: 10 # 3926 OOP.Object.Assignment.Aggregate.Assigning derived object to base variable ? OOP.Object.{Variable.Private.By Object Function,Constructor.By Client,Constructor.Inheritor.Coopted} > {{ public: (){>> ;<< ;} protected: private: ; } : public { public: (){();>> ;<< ;} protected: private: ; } (){ = (); } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Assigning object of one derived class to variable of another derived class - 3950 // Object.Assignment.Aggregate.Assigning derived object to different derived variable # 3950 OOP.Object.Assignment.Aggregate.Assigning derived object to different derived variable > {{ public: (){ = ;<< ;} protected: private: ; } : public { public: (){(); = R2#6<=R2<=9;#>;<< ;} protected: ; private: } : public { public: (){(); = R3#11<=R3<=14;#>;<< ;} ; protected: private: } (){ = .(); } > Type: debug_output Hardness: 10 # 3951 OOP.Object.Assignment.Aggregate.Assigning derived object to different derived variable > {{ public: (){>> ;<< ;} ; protected: private: } : public { public: (){();>> ;<< ;} protected: ; private: } : public { public: (){();>> ;<< ;} protected: private: ; } (){ = (); } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // ================================================================================= // // Called in ancestor function, which is in turn called by client // // Accessing public (B) data member by ancestral class - 4000 // Object.Variable.Public.By Ancestor # 4000 OOP.Object.Variable.Public.By Ancestor > {{ public: (){=;<< ; =;} ; protected: private: } : public { public: ; protected: private: } (){ = (); .();} } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (B) data member by ancestral class - 4025 // Object.Variable.Protected.By Ancestor # 4025 OOP.Object.Variable.Protected.By Ancestor > {{ public: (){>> ; >> ; << ;} protected: ; private: } : public { public: (){>> ;<< ;} protected: ; private: } (){ = (); .();} } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) data member by ancestral class - 4050 // Object.Variable.Private.By Ancestor # 4050 OOP.Object.Variable.Private.By Ancestor > {{ public: (){>> ; = ; << ;} protected: private: ; } : public { public: protected: (){>> ;; >> ;<< - ;} private: ; } (){ = (); .();} } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Called in inheritor function, which is in turn called by client // // Accessing public (B) member function by ancestral class - 4100 // Object.Function.Public.By Ancestor # 4100 OOP.Object.Function.Public.By Ancestor > {{ public: (){>> ;<< ; ();} protected: ; private: } : public { public: (){>> ; << ;} protected: ; private: } (){ = (); .();} } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (B) member function by ancestral class - 4125 // Object.Function.Protected.By Ancestor # 4125 OOP.Object.Function.Protected.By Ancestor > {{ public: (){ = ;<< ; = * 10; ();} protected: private: ; } : public { public: protected: (){ = ; << ;} private: ; } (){ = (); .();} } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) member function by ancestral class - 4150 // Object.Function.Private.By Ancestor # 4150 OOP.Object.Function.Private.By Ancestor > {{ public: (){>> ; << (); << ;} protected: ; private: } : public { public: ; protected: private: (){>> ;<< ;return ;} } (){ = (); .();} } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing public (B) data member wrt ancestral object by client - 4200 // Object.Variable.Public.Wrt Ancestor # 4200 OOP.Object.Variable.Public.Wrt Ancestor > {{ public: (){=;<< ;} protected: ; private: } : public { public: ; (){return ;} protected: private: } (){ = (); = ; . = ; << ;} } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (D) data member wrt ancestral object by client - 4225 // Object.Variable.Protected.Wrt Ancestor # 4225 OOP.Object.Variable.Protected.Wrt Ancestor > {{ public: (){>> ; = + 1; << ;} protected: private: ; } : public { public: (){>> ; = - 1; << ;} protected: ; private: } (){ = (); >> .; .();} } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) data member wrt ancestral object by client - 4250 // Object.Variable.Private.Wrt Ancestor # 4250 OOP.Object.Variable.Private.Wrt Ancestor > {{ public: (){>> ; = * 10; << ;} protected: ; private: } : public { public: protected: (){>> ; = * 2; << ;} private: ; } (){ = (); .(); . = ;} } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing public (B) member function wrt ancestral object by client - 4300 // Object.Function.Public.Wrt Ancestor # 4300 OOP.Object.Function.Public.Wrt Ancestor > {{ public: (){ = ;<< ;} protected: private: ; } : public { public: (){>> ; << ;} protected: private: ; } (){ = (); .();} } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing protected (D) member function wrt ancestral object by client - 4325 // Object.Function.Protected.Wrt Ancestor # 4325 OOP.Object.Function.Protected.Wrt Ancestor > {{ public: (){ = ;<< ;} protected: private: ; } : public { public: protected: (){ = ; << ;} private: ; } (){ = (); = ; .();} } > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // // Accessing private (D) member function wrt ancestral object by client - 4350 // Object.Function.Private.Wrt Ancestor # 4350 OOP.Object.Function.Private.Wrt Ancestor > {{ public: (){; >> ; >> ; if( < ){ << ; }else << ;} protected: private: ; } : public { public: protected: ; private: (){>> ;<< ;return ;} } (){ = (); << .(); } } > Input: "\n\n\n" > Type: debug_output Hardness: 10 // --------------------------------------------------------------------------------- // Used solely for testing code # 9000 OOP.Object.Variable.Public.By Object Function > {{ public: (){ = 29; << ;} (){return ;} (){if( >= 0){ =;} else { = 1;}} static (){<< ;} (){<< ;} ; static ; protected: // [5]; private: ; } { public: (){return ;} (){ = 51; << ;} ; private: ; } { public: ; (){ = 51; << ;} } (){ = .(); =13; >> ; . = ; << .(); = .(); // Following statement leads to stack overflow - why? // >> ..; . = ; << .(); = .(); }} > Input: "\n\n" > Type: debug_output Hardness: 10