- main.cpp
#include <iostream>
#include "Sally.h"
using namespace std;
int main()
{
int x = 3;
cout << x << endl;
Sally sal;
sal.printShiz();
const Sally sal2;
sal2.printShiz2();
return 0;
}
2.Sally.h
ifndef SALLY_H
define SALLY_H
class Sally
{
public:
Sally();
void printShiz();
void printShiz2() const;
protected:
private:
};
endif // SALLY_H
3.Sally.cpp
include "Sally.h"
include <iostream>
using namespace std;
Sally::Sally()
{
}
void Sally::printShiz()
{
cout << "first" << endl;
}
void Sally::printShiz2() const
{
cout << "second" << endl;
}
网友评论