
// ConsoleApplication37.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;
class homepage {
public:
homepage(string p, int h, int w);
~homepage()
{
cout << "delete";
}
void display();
protected:
string photo;
int height;
int width;
};
class area :public homepage
{
public:
int getArea()
{
return (height*width);
}
void putout();
};
homepage::homepage(string p, int h, int w)
{
photo =p;
height = h;
width = w;
}
void homepage::display()
{
cout << "photo:" << photo << "," << "height:" << height << "," << "width:" << width << endl;
}
void area::putout()
{
cout << "面积:" << ""<<endl;
}
int main()
{
homepage h("qwertyui",12,11);
h.display();
system("pause");
return 0;
}
//
#include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;
class homepage {
public:
homepage(string p, int h, int w);
~homepage()
{
cout << "delete";
}
void display();
protected:
string photo;
int height;
int width;
};
class area :public homepage
{
public:
int getArea()
{
return (height*width);
}
void putout();
};
homepage::homepage(string p, int h, int w)
{
photo =p;
height = h;
width = w;
}
void homepage::display()
{
cout << "photo:" << photo << "," << "height:" << height << "," << "width:" << width << endl;
}
void area::putout()
{
cout << "面积:" << ""<<endl;
}
int main()
{
homepage h("qwertyui",12,11);
h.display();
system("pause");
return 0;
}
[此贴子已经被作者于2017-10-22 15:11编辑过]