Ineritance:父/基类的值 [英] Ineritance: Values of parent/base class

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

问题描述

大家好


发布一篇关于这篇文章可能是一篇相当令人困惑的帖子,其他

日,所以我将再次去看看是否我可以更有意义。

这个sis纯粹是一个


我有一个叫做动物的基类,你可以从动物中获取

访问更多类别,如猫科动物,犬类,爬行动物和

两栖动物.....


要进入犬类,你要去通过动物。动物有很多

的公共物业,如身高和体重,我们可以从

我们的aspx访问。


所以首先所有我想做的动物。配置(iHeight,iWeight).....


在犬类内部,我希望能够访问
$的属性b $ b动物物品,所以我可以知道它有多大,有多高等等

- 这有意义吗?


我可以做犬犬=新犬();有点因为犬是动物的孩子 - 但是我不能动物去获取动物的物品。


你能帮帮忙吗?等待你是我永远的感激之情;)


非常感谢


Darren

Hi guys

Posted what was probably a rather confusing post about this the other
day, so I am going to have another go and see if I can make more sense.
This sis purely a

I''ve got a base class called animal, and from within animal you can
access lots more classes such as feline, canine, reptile and
amphibian.....

To access canine, you are going to go through animal. Animal has lots
of public properties such as height and weight that we can access from
our aspx.

So first of all I want to do animal.configure(iHeight, iWeight).....

Inside canine, I would like to be able to access the properties of the
animal object, so i can find out how big it is, how tall it is etc etc
- does that make sense?

I can do the canine canine = new canine(); bit so that canine is a
child of animal - but I can''t get animal to access the properties of
animal.

Can you help?? Awaiting you is my eternal gratitude ;)

Many thanks

Darren

推荐答案

***抱歉! ***


在纠正上述内容时,最后一段的旁边应为:


我可以做犬犬=新犬();有点因为犬是一个动物的孩子 - 但是我无法通过CANINE获得

动物的财产。


谢谢


Daz

*** SORRY! ***

In correction to the above, the next to last paragraph should read:

I can do the canine canine = new canine(); bit so that canine is a
child of animal - but I can''t get CANINE to access the properties of
animal.

Thanks

Daz


你能发一些代码吗?


你是动物的动物吗?


类犬:动物

{


}

Steph。

< Da ************** @ gmail.com>在消息中写道

news:11 ********************** @ g10g2000cwb.googlegr oups.com ...
Can you post some code ???

Do you dervie Canine from Animal ?

class Canine : Animal
{

}
Steph.
<Da**************@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
大家好吧

发布一篇关于这个日子可能相当令人困惑的帖子,所以我要再去看看,看看我是否能更有意义。<这个sis纯粹是一个

我有一个叫做动物的基类,从动物体内你可以访问更多的类,如猫科动物,犬类,爬行动物和动物两栖动物.....

要进入犬类,你将要经历动物。动物有很多公共属性,如身高和体重,我们可以从我们的aspx访问。

首先,我想做动物配置(iHeight,iWeight) )......... /
在犬的内部,我希望能够访问动物对象的属性,所以我可以知道它有多大,有多高等等
- 这有意义吗?

我可以做犬犬=新犬();有点因为犬是动物的孩子 - 但我不能让动物进入动物的属性。

你能帮帮忙吗?等待你是我永远的感激之情;)

非常感谢

Darren
Hi guys

Posted what was probably a rather confusing post about this the other
day, so I am going to have another go and see if I can make more sense.
This sis purely a

I''ve got a base class called animal, and from within animal you can
access lots more classes such as feline, canine, reptile and
amphibian.....

To access canine, you are going to go through animal. Animal has lots
of public properties such as height and weight that we can access from
our aspx.

So first of all I want to do animal.configure(iHeight, iWeight).....

Inside canine, I would like to be able to access the properties of the
animal object, so i can find out how big it is, how tall it is etc etc
- does that make sense?

I can do the canine canine = new canine(); bit so that canine is a
child of animal - but I can''t get animal to access the properties of
animal.

Can you help?? Awaiting you is my eternal gratitude ;)

Many thanks

Darren






< Da ************** @ gmail.com>在消息中写道

news:11 ********************** @ g10g2000cwb.googlegr oups.com ...
Hi,

<Da**************@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
大家好

我有一个叫做动物的基类,从动物体内你可以访问更多的类,如猫科动物,犬类,爬行动物和两栖动物.....


你不能访问它们,你在所有其他类中派生动物

要进入犬类,你将会去通过动物。


你的意思是什么?

在犬的内部,我希望能够访问动物对象的属性,所以我可以看出它有多大,它有多高等等
- 这有意义吗?
是。

你将能够,除非你宣布他们是私人的


我可以做犬犬=新犬();有点因为犬是动物的孩子 - 但我不能动物去获取动物的属性。
你能帮帮忙吗?等待你是我永远的感激之情;)
Hi guys
I''ve got a base class called animal, and from within animal you can
access lots more classes such as feline, canine, reptile and
amphibian.....
You do not access them, you derive Animal in all those other classes
To access canine, you are going to go through animal.
What you mean with this?

Inside canine, I would like to be able to access the properties of the
animal object, so i can find out how big it is, how tall it is etc etc
- does that make sense? Yes.
You will be able, unless you declare them as private

I can do the canine canine = new canine(); bit so that canine is a
child of animal - but I can''t get animal to access the properties of
animal. Can you help?? Awaiting you is my eternal gratitude ;)




发布一段代码,问题是什么以及你得到的错误



Post a piece of code whith what the problem is and the error you are getting


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

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