#include<iostream>
#include<string>
using namespace std;
class Point
{
public:
int x1=2;
int y1=2;
};
class Square :private Point
{
public:
int x2=4;
int y2=4;
int k=0;
int Sm()
{
k = (x2 - x1) * (y2 - y1);
return k;
cout << "k的值为" << k << endl;
}
};
int main()
{
Square s1;
s1.Sm();
}
我用的是VS2019的,然后编译没错,但输出没结果。