473,320 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Q: Example from the Holy Writ

This is from the C++ Standard: ISO/IEC 14882:2003(E)
Any deviation from the text in the Standard document is an unintentional
transcription error on my part. I'm fairly confident about the reasoning
behind every part except the line with the comment // does not declare f.
I'm not sure if it is merely pointing out that no f is declared in the
definition of VB1a, or suggesting something more subtle. I believe the
former is the case, and the intent of the example is to show VB2::f()
overrides the virtual A::f(). Da then inherits the overridden f from VB2.

This is the DAG of what I think is happening.

A has virtual f()
/ \
/ \
/ \
VB1a no f() VB2 overrides f()
\ /
\ /
\ /
Da inherits f() from VB2

I am I understanding this correctly?

/*
The following example shows a function that does not have a unique
final overrider:
*/
struct A {
virtual void f();
};

struct VB1 : virtual A { // note virtual derivation
void f();
};

struct VB2 : virtual A {
void f();
};

/*
struct Error : VB1, VB2 { // ill-formed
};
*/

struct Okay : VB1, VB2 {
void f();
};

/*
Both VB1::f and VB2::f override A::f but there is no overrider of
both of them in class Error. This example is therefore
ill-formed. Class Okay is well formed, however, because Okay::f is a
final overrider.

The following example uses the well-formed classes from above.
*/

struct VB1a : virtual A { // does not declare f
};

struct Da : VB1a, VB2 {
};

void foe() {
VB1a* vb1ap = new Da;
vb1ap->f(); //calls VB2::f
}

--
p->m == (*p).m == p[0].m
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org
Jul 22 '05 #1
3 1685
...fgn,;lgm;
"Steven T. Hatton" <su******@setidava.kushan.aa> wrote in message
news:TO********************@speakeasy.net...
This is from the C++ Standard: ISO/IEC 14882:2003(E)
Any deviation from the text in the Standard document is an unintentional
transcription error on my part. I'm fairly confident about the reasoning
behind every part except the line with the comment // does not declare f.
I'm not sure if it is merely pointing out that no f is declared in the
definition of VB1a, or suggesting something more subtle. I believe the
former is the case, and the intent of the example is to show VB2::f()
overrides the virtual A::f(). Da then inherits the overridden f from VB2.

This is the DAG of what I think is happening.

A has virtual f()
/ \
/ \
/ \
VB1a no f() VB2 overrides f()
\ /
\ /
\ /
Da inherits f() from VB2

I am I understanding this correctly?

/*
The following example shows a function that does not have a unique
final overrider:
*/
struct A {
virtual void f();
};

struct VB1 : virtual A { // note virtual derivation
void f();
};

struct VB2 : virtual A {
void f();
};

/*
struct Error : VB1, VB2 { // ill-formed
};
*/

struct Okay : VB1, VB2 {
void f();
};

/*
Both VB1::f and VB2::f override A::f but there is no overrider of
both of them in class Error. This example is therefore
ill-formed. Class Okay is well formed, however, because Okay::f is a
final overrider.

The following example uses the well-formed classes from above.
*/

struct VB1a : virtual A { // does not declare f
};

struct Da : VB1a, VB2 {
};

void foe() {
VB1a* vb1ap = new Da;
vb1ap->f(); //calls VB2::f
}

--
p->m == (*p).m == p[0].m
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org

Jul 22 '05 #2
test
"pctv06" <pc****@netvigator.com> дÈëÏûÏ¢ÐÂÎÅ
:c4*********@imsp212.netvigator.com...
..fgn,;lgm;
"Steven T. Hatton" <su******@setidava.kushan.aa> wrote in message
news:TO********************@speakeasy.net...
This is from the C++ Standard: ISO/IEC 14882:2003(E)
Any deviation from the text in the Standard document is an unintentional
transcription error on my part. I'm fairly confident about the reasoning
behind every part except the line with the comment // does not declare f. I'm not sure if it is merely pointing out that no f is declared in the
definition of VB1a, or suggesting something more subtle. I believe the
former is the case, and the intent of the example is to show VB2::f()
overrides the virtual A::f(). Da then inherits the overridden f from VB2.
This is the DAG of what I think is happening.

A has virtual f()
/ \
/ \
/ \
VB1a no f() VB2 overrides f()
\ /
\ /
\ /
Da inherits f() from VB2

I am I understanding this correctly?

/*
The following example shows a function that does not have a unique
final overrider:
*/
struct A {
virtual void f();
};

struct VB1 : virtual A { // note virtual derivation
void f();
};

struct VB2 : virtual A {
void f();
};

/*
struct Error : VB1, VB2 { // ill-formed
};
*/

struct Okay : VB1, VB2 {
void f();
};

/*
Both VB1::f and VB2::f override A::f but there is no overrider of
both of them in class Error. This example is therefore
ill-formed. Class Okay is well formed, however, because Okay::f is a
final overrider.

The following example uses the well-formed classes from above.
*/

struct VB1a : virtual A { // does not declare f
};

struct Da : VB1a, VB2 {
};

void foe() {
VB1a* vb1ap = new Da;
vb1ap->f(); //calls VB2::f
}

--
p->m == (*p).m == p[0].m
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org


Jul 22 '05 #3
rock wrote:
test


Please don't spam this group with this useless crap. There are groups
for testing, and this isn't one of them. There's also no need to quote
80 irrelevant lines of text. And in the future, if you have something
useful to say, please post correctly (e.g., don't top-post).

http://www.parashift.com/c++-faq-lite/how-to-post.html

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
3
by: Steven T. Hatton | last post by:
This is from the C++ Standard: ISO/IEC 14882:2003(E) Any deviation from the text in the Standard document is an unintentional transcription error on my part. I'm fairly confident about the...
23
by: Alberto | last post by:
An OUTSTANDING example of a rebuttal. Worth a glance. Rather long, OBVIOUSLY feel fee to dismiss it entirely if not interested. But this habit of the rebuttals must go to a stop (forgive odd...
10
by: Xah Lee | last post by:
today i need to use Python to decompress gzip files. since i'm familiar with Python doc and have 10 years of computing experience with 4 years in unix admin and perl, i have quickly located the...
2
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
11
by: ajikoe | last post by:
Hello, I used Visual C# Standard Edition. I want to comment my program using xml commentary method, I don't know why if I use value and example tag, it is not working / showed in the html...
0
by: booktwo | last post by:
Back from Africa, where I was a secular missionary in the Kayon Ghozi's leprosary (Burundi) because of health reasons, I wrote these lucky Flashes of mine, which got a resounding success ,on...
318
by: jacob navia | last post by:
Rcently I posted code in this group, to help a user that asked to know how he could find out the size of a block allocated with malloc. As always when I post something, the same group of people...
18
by: BobTheBowler | last post by:
Hi Spent the past week looking at CSS renderings of "liquid" 3-column pages (with both Header and Footer that can also grow). On testing, none of them seem fully cross-browser campatible. ...
4
by: TamusJRoyce | last post by:
Looking at various Holy Grail techniques for html layouts, I came across Faux Positioning Layout. What I'm curious about is the differences between the two. I have no understanding of the Holy...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.