input: 
  class SumOfDigits:
      
      def __init__(self, num):
          self.num = num
      
      def calculate_sum_of_digits(self):
          total = 0
          for ch in str(self.num):
              total += int(ch)
          return total
  
  digit_sum = SumOfDigits(6342)
  result = digit_sum.calculate_sum_of_digits()
  print(result)
  
  
  The task is to create a Python class named `SumOfDigits` that initializes with a given number and provides a method to calculate the sum of its digits. Following the class definition, an instance of `SumOfDigits` is created with the input `6342`, and the sum of its digits is calculated and printed. To craft an appropriate question based on your request, I will provide a Python code snippet followed by an instruction describing a related task, input, and output.
  
  ### Question:
  
  
  class SumOfDigits:
      
      def __init__(self, num):
          self.num = num
      
      def calculate_sum_of_digits(self):
          total = 0
          for ch in str(self.num):
              total += int(ch)
          return total
  
  digit_sum = SumOfDigits(6342)
  result = digit_sum.calculate_sum_of_digits()
  print(result)
  
  
  Based on the provided code, create a function that calculates and returns the sum of the digits of a given integer. The function should be able to handle different integers and return the correct sum.
  
  ### Example:
  
  Input:
  
  12345
  
  
  Output:
  
  15
  
  
  Correct Answer:
  
  def sum_of_digits(num):
      total = 0
      for ch in str(num):
          total += int(ch)
      return total
  
  
  Explanation:
  The provided function `sum_of_digits` takes an integer as input, iterates through its digits converted to a string, converts each character back to an integer, and sums them up. In the example, the sum of the digits of `12345` is `1 + 2 + 3 + 4 + 5 = 15`.
output:     
  def sum_of_digits(num):
      total = 0
      for ch in str(num):
          total += int(ch)
      return total
  