Consider the following class definition: (8) class base { public: void setXYZ(int a, int b, int c); void setX(int a); int getX() const { return x; } void setY(int b); int getY() const { return y; } int mystryNum() { return (x * y - z * z); } void print() const; base() {} base(int a, int b, int c); protected: void setZ(int c) { z = c; } void secret(); int z = 0; private: int x = 0; int y = 0; }; a. Which member functions of the class base are protected? b. Which member functions of the class base are inline? c. Write the statements that derive the class myClass from class base as a public inheritance. d. Determine which members of class base are private, protected, and public in class myClass.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Consider the following class definition: (8)
class base
{
public:
void setXYZ(int a, int b, int c);
void setX(int a);
int getX() const { return x; }
void setY(int b);
int getY() const { return y; }
int mystryNum() { return (x * y - z * z); }
void print() const;
base() {}
base(int a, int b, int c);
protected:
void setZ(int c) { z = c; }
void secret();
int z = 0;
private:
int x = 0;
int y = 0;
};
a. Which member functions of the class base are protected?
b. Which member functions of the class base are inline?
c. Write the statements that derive the class myClass from class
base as a public inheritance.
d. Determine which members of class base are private, protected,
and public in class myClass.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps