Making program Object-Oriented (class)

Got it working thank you so much!
Last edited on
Before you start refresh yourself on classes.
http://www.cplusplus.com/doc/tutorial/classes/

myClass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef _MYCLASS_H_
#define _MYCLASS_H_

class MyClass
{
public:
    MyClass();
    
    void read();
    void write();
private:
    std::string fileName; //idk what you want in here
};
#endif 


myClass.cpp
1
2
3
4
5
6
7
8
9
10
11
#include "myClass.h"
//You do the hard work
void MyClass::read()
{

}

void MyClass::write()
{

}


main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "myClass.h"

int main( int argc, char** argv )
{
    MyClass myClass;
    //Show your menu
    //Ask for input
    //if input = 1
    myClass.read();
    //if input = 2
    myClaass.write();
    return 0;
}


Last edited on
Thank you so much! I'll get started right away.
Topic archived. No new replies allowed.