基类和继承 [英] Base Class and Inheritance

查看:71
本文介绍了基类和继承的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在努力完成我的课程工作,并坚持不解决问题。


我有三个班:汽车,小巴和卡车。

我希望这辆车成为我的基地和小巴,卡车继承了汽车类的财产。


我不断收到错误消息:


''xxxx.Car''不包含带0参数的构造函数。这适用于小巴和卡车。


这是我的车类:

展开 | 选择 | Wrap | 行号

解决方案

您的汽车类名为FrmCar:

展开 | 选择 | Wrap | 行号


FrmCar是我创建的表单/添加新车。

Car.cs是具有特殊性的汽车类别。


我这样做是错误的吗?

感谢您的回复,


迈克


ps我使用VS如果有所作为。


再次


我发错了代码。这不是car.cs你是对的是FrmCar:)


这是我的汽车类代码:

展开 < span class =codeDivider> | 选择 | Wrap | Line编号

Hi there all,

Im curently working on my course work and got stuck on of the questions.

I have three classes : car, minibus and truck.
I want the car to be my base and minibus, truck to inherit the property of the car class.

I keep getting an error message :

''xxxx.Car'' does not contain the constructor that takes 0 arguments. This is for both minibus and truck.

Here is my car class :

Expand|Select|Wrap|Line Numbers

解决方案

Your car class is called FrmCar :

Expand|Select|Wrap|Line Numbers


FrmCar is my form in which i create/add new cars.
Car.cs is the car class with properites ect.

Am I doing it the wrong way?
Thanks for you reply,

Mike

p.s Im using VS if that makes a difference.


Hi again,

I posted in the wrong code. It was not car.cs you were right it was FrmCar : )

Here is my code for the car class :

Expand|Select|Wrap|Line Numbers


这篇关于基类和继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆