1

My code looks like this

#include <iostream>

class area {
private:
  double data;

public:
  area(double data);
};

area::area(double data) { this->data = data; }

int main() {
  area areas[2]; //here's the problem

  return 0;
}

It's not supposed to do anything in particular other than me trying to fiddle with classes.

I can either create area areas[2]; or area areas(arguments); Is there even a way to do both of them at the same time? I know you can create an array and then use separate function.

kalehmann
  • 4,821
  • 6
  • 26
  • 36
istir
  • 11
  • 1
  • 3

0 Answers0