Object Oriented Programming - Old Questions

Question Answer Details

2. Differentiate between abstract class and concrete class. Write a program to create a class named 'Quadratic' that represents a function of the form f(x) = ax² + bx + c, where x is a real variable and a, b, c are real constants. The class must satisfy the following requirements:
a. A constructor should be provided that takes the values of a, b, and c as arguments. All three of these arguments should default to zero.
b. A function that takes a single argument x and returns the value of f(x).
c. All data members should be private. [2+8]

10 marks
Asked in 2079

Answer

AI Generated Answer

AI is thinking...