Question: c++ question: What is the reason why this class doesnt allow instantiation of an object? __________ (2 points) // Galaxy.cpp class Galaxy // class definition

c++ question:

What is the reason why this class doesnt allow instantiation of an object? __________ (2 points)

// Galaxy.cpp

class Galaxy // class definition

{

private: string name; // member field

Galaxy(string name) // constructor

{ this->name=name; }

public:

string get () // getter member method

{ return name; }

void set(string name) // setter member method

{ this->name=name; }

};

Select one:

a. There are syntax errors in the code.

b. It is because the name field is declared as private.

c. It is because the constructor is declared as private.

d. None of the choices

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!