使用指针继承:重载? [英] Inheritance with pointers:Overloading?

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

问题描述

我的一个基类是一个linklist class.now我想继承它

另一个类。问题是当我使用派生类我不能

访问基类'的pointers.classic类型mismatch.how我链接

派生类如果我不能比较派生类的指针

linklist类的指针?

我是否通过重载来实现?我试过了,但是可以让它工作。我是

手册(所有4个)都没有关于如何进行超载的例子。如果你愿意,可以给某人提供帮助吗?请发送电子邮件。请在截止日期前完成!

解决方案

Katie写道:

我的一个基类是一个linklist类。


您已经定义了一个名为linklist的类。好的。

现在我想通过
另一堂课继承它。


您想要定义另一个类,派生自linklist。好的。

问题是,当我使用派生类时,我无法访问基类的指针。


现在你失去了我。为什么不?什么指针?你如何使用

派生类?

经典类型不匹配。


什么?

如果我无法比较派生的
类的指向链接列表的指针,如何链接派生类班级的指针?


链接是什么意思?一个类?


你_can_比较基类指针和派生类指针

的相等性。您是否使用了两个等号,例如`==''?

我是否通过重载执行此操作?


我不应该这么认为。如果不知道更多关于

问题的话,那就不可能肯定地说了。

我试过了,但可以让它运转起来。


正确。

我的手册(所有4个)都没有关于如何进行重载的示例。


借或购买更好的书。 ACCU网站上有​​评论。

最近的评论更有用,因为人们使用C ++

的方式已经发展。 C ++编程语言,第3版/特别版,Bjarne Stroustrup的
,很好地涵盖了整个语言。我不知道

它非常适合初学者。

有人可以帮忙吗?


我试过了,真的。我不明白你想要做什么。

你能告诉我们你想要编译的程序吗?
如果你愿意的话,可以用b $ b电子邮件。


发布在这里,请在这里阅读。

拜托,我在截止日期!




祝你好运。


-

问候,

巴斯特。


my one base class is a linklist class.now i''d like to inherit it by
another class.The problem is that when i use the derived class i can''t
access the base class''s pointers.classic type mismatch.how do i link
the derived class if i can''t compare the derived class''s pointers to
the linklist class''s pointers?
do i do it with overloading?i tried that,but could get it to work.my
handbooks (all 4 of them) has no example on how to do overloading.can
someone help?e-mail if you want to.please, i''m on a deadline!!!

解决方案

Katie wrote:

my one base class is a linklist class.
You have defined a class called "linklist". OK.
now i''d like to inherit it by
another class.
You want to define another class, derived from "linklist". OK.
The problem is that when i use the derived class i can''t
access the base class''s pointers.
Now you''ve lost me. Why not? What pointers? How do you "use"
the derived class?
classic type mismatch.
What?
how do i link the derived class if i can''t compare the derived
class''s pointers to the linklist class''s pointers?
What does it mean to "link" a class?

You _can_ compare a base class pointer and a derived class pointer
for equality. Did you use two equals signs, like `==''?
do i do it with overloading?
I shouldn''t think so. Without knowing more about the
problem it''s impossible to say for sure.
i tried that,but could get it to work.
Right.
my handbooks (all 4 of them) has no example on how to do overloading.
Borrow or buy a better book. There are reviews on the ACCU site.
More recent reviews are more useful because the way people use C++
has evolved. "The C++ Programming Language", 3rd/Special edition,
by Bjarne Stroustrup, covers the whole language nicely. I don''t know
that it''s very suitable for a beginner.
can someone help?
I tried, really. I don''t understand what you are trying to do.
Can you show us the program you are trying to compile?
e-mail if you want to.
Post here, read here.
please, i''m on a deadline!!!



Good luck with that.

--
Regards,
Buster.


这篇关于使用指针继承:重载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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