C++ Class Member Function

C++ examples for Class:Member Function


Click the following links for the tutorial for Class and Member Function.

  1. Declaring two objects of the same type in a function
  2. Creating and using member functions
  3. Inline Member Functions
  4. Create inline functions with inline keyword
  5. Fraction Class with inline member function
  6. Fraction class with member Functions
  7. Fraction class Arithmetic member function: add and mult
  8. Define and invoke a function that's a member of the class Employee

  9. Defining a Member Function in the Class
  10. Overloading Member Functions
  11. Demonstrates use of default arguments in class member functions.
  12. Demonstrates use of in-line class member functions.
  13. Demonstrates use of class member functions.
  14. Sphere class with member functions added
  15. Overloading Functions in a Class
  16. Taking the Address of a Member Function

  17. Change the member functions to inline.
  18. Const Pointers and const Member Functions
  19. Overloaded Member Functions
  20. Arrays of Pointers to Member Functions
  21. Adding Methods to class
  22. Determine class average based on 10 grades entered by user in class member function
  23. Definition of class Course that determines a class average.
  24. Fill the Two Largest Numbers to class
  25. Demonstrating the class member access operators . and ->
  26. Pass Objects to function and return object from functions.
  27. Defining and Using const Member Functions
  28. Initializing a const Data Member with a Member Initializer
  29. Create Date Class to format date value
  30. Create Time Class and use number of seconds to represent time
  31. Create class to represent Card Shuffling and Dealing
  32. Create Employee class definition represents a commission employee.
  33. Pointers to Class Members with .* and ->*, pointer-to-class-member operators.
  34. Using a function with a reference parameter in the Integer class
  35. Implementing add(), subtract() and multiply() for Integer class
  36. Implementing compare()as a friend function for Integer class
  37. Demonstrate const member functions
  38. Const member functions and const arguments to member functions
  39. Function returns value of type Measure
  40. Creates safe array, index values are checked before access, uses one access() function for both put and get
  41. Creates safe array, index values are checked before access
  42. Change value on const object value with setter
  43. Create member square() function for Measure
  44. Create array class
  45. Add accessor function to read member field
  46. Add inline member function to change member field value
  47. Add mutator function to change class member field value
  48. Add accessor functions to get the private member fields