// AnE.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
// The maximum number of patients in queue
#define MAXPATIENTS 30
// define structure for patient information
struct patient
{
char FirstName[50];
char LastName[50];
char ID[20];
};
// define class for queue
class queue
{
public:
queue (void);
int RegisterPatien (patient p);
int RegisterPatientAtBeginning (patient p);
patient GetNextPatient (void);
int CancelAll (patient * p);
void OutputList (void);
char DepartmentName[50]; …
Run Code Online (Sandbox Code Playgroud) 我有一个名为的抽象类PersonAbstract
.它有一个名为的抽象属性Age
abstract public int Age { get; set; }
Run Code Online (Sandbox Code Playgroud)
两个类调用Customer
并Employee
扩展PersonAbstract
.
Customer
并Employee
使用Linq-to-SQL创建,因此它们具有自动生成的代码.
这两个的自动生成代码:
public int Age
{
get
{
return this._age;
}
set
{
this._age = value;
}
}
Run Code Online (Sandbox Code Playgroud)
我向部分类添加功能Employee
并Customer
使用它.
public partial class Employee: PersonAbstract
{
.....
Run Code Online (Sandbox Code Playgroud)
如何更改此结构,以便继承的类(Employee
和Customer
)使其person属性覆盖抽象类中的person属性而不触及自动生成的代码?
编辑:
问题是我希望两个类共享一些父类的代码.所以我一直在尝试在实现具有Age
属性的接口和两个子类之间添加带有共享代码的抽象类.但该代码需要访问该Age
属性.因此抽象类必须使用Age
属性的抽象实例来实现接口,子类重写它.如果这不可能,我怎样才能达到预期的效果呢?
我感觉这个问题以前已经回答过很多次了,但我找不到任何东西。
我有一个脚本,它将文本作为命令行参数,然后生成包含文本的图像。它为在命令行中输入的每个单词生成图像,但我不知道如何保存它们。我想这样拯救他们;第一个图像将保存为 0001.png,第二个图像将保存为 0002.png 等等,我该怎么做?
我只需要在每个if语句中为每个数字添加+30.我需要其中的36个,有没有办法让乌龟在陈述或类似的东西上做得更多?我真的被卡住了,手动方式会很疯狂.
例如:
if 0 <= x <=30 and 0 <= y <= 30:
turtle.drawsstuff
if 30 <= x <=60 and 0 <= y <= 60:
etc.
Run Code Online (Sandbox Code Playgroud)