For example, I have a class called Apple and another class called Basket and I want the class Basket to have a private attribute that is an array of Apple objects.
My code:
basket.h
#include <iostream>
#include <string>
#include <apple.h>
// defin basket
class Basket {
//class attrs; private
private:
std::string name;
// I want Basket objects to have an array of Apple objects
// How do I do this?
Apple [];
public: //class function
Basket(std::string); //constructor
std::string get_name() {return (name);}
};
apple.h
#include <iostream>
#include <string>
// defin apple
class Apple {
//class attrs; private
private:
std::string name;
public: //class function
Apple(std::string); //constructor
std::string get_name() {return (name);}
};