float values[] = { 1.0f, 2.0f, 3.0f }; FloatArray arr(values, 3);
FloatArray arr(values, 3); float element = arr.at(1); // access the second element std::cout << "Element at index 1: " << element << std::endl; // Output: Element at index 1: 2.0
FloatArray arr(values, 3); arr.at(1) = 4.0f; // set the second element to 4.0
class FloatArray { public: FloatArray(float* values, int size); float& at(int index); private: float* m_data; int m_size; }; #include "FloatArray.cpp"The implementation file, FloatArray.cpp, would then contain the actual implementation of the functions.