|
|
|
Tresor h.
#include <iostream>
using namespace std;
class Tresor
{
private:
int topSecret;
protected:
int secret;
void setTopSecret ( int n){ topSecret = n;}
int getTopSecret() const { return topSecret;}
void setSecret ( int n) { secret = n; }
int getSecret() const { return secret; }
public:
int notSecret;
Tresor()
{ topSecret = 100; secret = 10; notSecret = 0; }
};
class Schloss : public Tresor
{
public:
Schloss()
{
setTopSecret(10);
secret = 1;
notSecret = 0;
}
void test()
{
setTopSecret(200);
secret = 20;
notSecret = 2;
}
void display()
{
cout << "nTop-Secret: " << getTopSecret()
<< "nSecret: "<< secret
<< "nNot-Secret: "<< notSecret
<< endl;
}
};
Tresor cpp.
#include "tresor.h"
int main()
{
Schloss test;
test.display();
test.test();
test.display();
system("Pause");
return 0;
|
|
|
|
|
|
|