HMehrpouya 0 Newbie Poster

I want to have two classes one for creating the dataset as a factory class and the other is my Dataset class. factory class could read data from files or memory address and also it can create random data and finally returns a dataset. first i want to implement the random data methode and return a dataset from it. I Don't know what is the best way for defining my dataset class and how to use the factory class. let's say we have three classes 1.main.cpp , 2.Dataset 3.FactoryDataset how should i declare the variables and pass them between classes. The data structure i used for holding the data is my customized structure

struct MyDoublePoint {double x ; double y ;}

then i use std vector for holding the points. and also please tell me where should i declare the vector variable in the dataset class i mean should i declare it as static member private or public? sorry I'm not used to c++. thank you.

CDataSet  CDSFactory::GenerateDS ( const double minX, const  double maxX, const  double minY, const  double maxY, const  int recordCount)
{
	//holding variables withing the class for further use
	m_minX=minX;
	m_maxX=maxX;
	m_minY=minY;
	m_maxY=maxY;
	m_recordCount=recordCount;
	
	//generating data and calculating the min and max value for X , Y
	int end=recordCount-1;
	MyDoublePoint myPoint;

		for ( int index = 0 ; index < end ; index+=1 )
		{
			myPoint.x=GetRandom(minX,maxX); 
			myPoint.y=GetRandom(minY,maxY); 
			m_ds.m_Data.push_back(myPoint);
			
			m_minX=min(m_minX,m_ds.m_Data[index].x);
			m_maxX=max(m_maxX,m_ds.m_Data[index].y);
		}
		return m_ds;// i don't know how to return the data set and also where to declare it
}