7) Write an implementation of this class using the C++ language. (i.e. implementation of the abstract class and all of its functions definition)
a. Class label: MyClass
b. Private members: int y, int array[10]
c. Public members: void sety(int a);
int gety();
void set_array(int a[], int size);
MyClass(int a, int a[], int size);

4 Years
Discussion Span
Last Post by Benard joseph

What exactly do you want? If you want the stated to be written so you can complete your homework without effort, I don't think that will happen. To begin with you can look at class declarations, learn about Object oriented programming.

class MyClass { }
will create a class with the name MyClass. Each class can have many fields which are decleared public/private/protected. In most cases you'll set them as private so its a good start. Each field has a type such as bool (boolean), int(integer), String etc. When you declear fields you choose their scope and give the variable a name such as int MyInt reserves a space in memory for an integer called MyInt. You can set it to any real value using = so MyInt = 0;
Each class has a number of methods. Such as for example private int getMyInt() which by declaration returns an int ( declared in the method body). If you want a method to not return anything you set it as void. Now, if we want our method to return the value of MyInt then in the method body we have return MyInt. I think this is a good start to begin with

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.