A class Stockltems has four data members and three function members. You define 50 objects as members of the class. Which is true? A. Only one copy of each of the three functions exists B. Only one copy of each of the four data members exists C. Both (a) and (b) are true D. Neither (a) nor (b) is true

Only one copy of each of the three functions exists
Only one copy of each of the four data members exists
Both (a) and (b) are true
Neither (a) nor (b) is true

The correct answer is: C. Both (a) and (b) are true.

A class is a blueprint for creating objects. When you define a class, you define the data members and function members that will be available to all objects of that class. When you create an object of a class, you are creating a new instance of that class. Each object has its own copy of the data members of the class. However, all objects of the same class share the same copy of the function members of the class.

In this case,

the class Stockltems has four data members and three function members. When you define 50 objects as members of the class, each object will have its own copy of the four data members. However, all 50 objects will share the same copy of the three function members.

Here is an example of how you might define the class Stockltems:

“`class Stockltems {
private:
int id;
std::string name;
double price;

public:
void setId(int id) { this->id = id; }
int getId() { return id; }
void setName(std::string name) { this->name = name; }
std::string getName() { return name; }
void setPrice(double price) { this->price = price; }
double getPrice() { return price; }
};
“`

Here is an example of how you might create 50 objects of the class Stockltems:

Stockltems item1;
Stockltems item2;
Stockltems item3;
...
Stockltems item50;

Each of these objects will have its own copy of the data members id, name, and price. However, all 50 objects will share the same copy of the function members setId(), getId(), setName(), getName(), and setPrice().