Scope and Accessing Class Members
·
A class’s data members and member functions belong
to that class’s scope.
·
Nonmember functions are defined at global namespace
scope.
·
Within a class’s scope, class members are
immediately accessible by all of that class’s member functions and can be
referenced by name.
·
Outside a class’s scope, class members are
referenced through one of the handles on an object: an object name, a reference
to an object, or a pointer to an object.
·
Member functions of a class can be overloaded only
by other member functions of that class.
·
To overload a member function, provide in the class
definition a prototype for each version
·
of the overloaded function, and provide a separate
definition for each version of the function.
·
Variables declared in a member function have local
scope and are known only to that function.
·
The dot member selection operator (.) is preceded
by an object’s name or by a reference to an object to access the object’s
public members.
·
Constructors with Default Arguments
·
Like other functions, constructors can specify
default arguments.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.