CLasses with arrays

Hello,

I'm trying to figure out how to print this class which contains an array filled with random numbers. My code is obviously throwing me an error that says: cannot use dot operator on a type. I just want to know how to make this work? Thanks for reading.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
using namespace std;

class Master {
public:
    
    void arrayFill(int a[], int x) {
        
        for(int i = 0; i < x; i++) a[i] = rand() % 10;
    }
    
    void arrayPrint(int a[], int x) {
        for(int i = 0; i < x; i++) cout << a[i] << " " << endl;
    }
    

int main() {
    
    int g[3];
    
    Master.arrayFill(g, 3);
    Master.arrayPrint(g, 3);

    return 0;
}
You'll need to read again about classes, you forgot one key point - http://www.tutorialspoint.com/cplusplus/cpp_classes_objects.htm

The object.
I GOT I!! Thank you man.
You're welcome <3
Topic archived. No new replies allowed.