Groups
Groups
Sign in
Groups
Groups
初韵编程语言
Conversations
About
Send feedback
Help
<数> 允许将基类对象赋值给派生类
78 views
Skip to first unread message
自由建客
unread,
May 3, 2013, 4:16:42 AM
5/3/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 初韵编程语言
似乎这样才够自然,尽管当今世上语言都不支持。
比如:
class A;
class B: A;
A a;
B b:= a;
自由建客
unread,
May 4, 2013, 4:04:45 AM
5/4/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 初韵编程语言
似乎这样也并不妥当。将基类对象赋值给派生类,这其中的意义如何解释?再者,若允许这样,那函数参数岂不是会混乱不堪!
其实真正需要的只是这样:
B b(a);
以基类对象作参数,派生类参考基类对象创建一个新对象。
Reply all
Reply to author
Forward
0 new messages