473,505 Members | 14,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Are these valid rules in C++ ?

7 New Member
How many rules below are valid in C++

Use of pointers:

1) base-class pointer to base-class object is ok

2) derived-class pointer to derived-class object is ok
3) base-class pointer to derived-class object is ok, but only for reference to base-class members
==>Is this rule valid for virtual functions ?? As per my knowledge we can invoke
derived class virtual function with base class object pointer pointed to derived
class object memory address.


4) derived-class pointer to base-class object is not allowed without explicit cast


thanks,
chetan.
Oct 29 '07 #1
3 1113
sicarie
4,677 Recognized Expert Moderator Specialist
chetanamale-

Have you tried creating examples of these on your own? Have you tried researching related material to figure this out? What did you look at? What have you tried?
Oct 29 '07 #2
chetanamale
7 New Member
Hi :

I tried examples of these and got more confused.....like i pointed out for rule number three, i seen contradictions what is mentioned there and what is true about virtual functions, I'm really confused.One liner responses to my questions
will also do....

thanks.
Oct 30 '07 #3
sicarie
4,677 Recognized Expert Moderator Specialist
Okay, so what did you try? Where did you get confused with it?
Oct 30 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

38
3574
by: Jukka K. Korpela | last post by:
As well all know, valid markup is important... but when trying to find a convincing modern argument in favor of this, I found pages like http://www.htmlhelp.com/tools/validator/reasons.html which...
18
2439
by: Neal | last post by:
According to the specs (http://www.w3.org/TR/html401/struct/links.html#h-12.2), the <a> element requires an end tag. And so, when we use <A NAME="foo"> in HTML 2.0 to 4.01, it won't validate,...
9
2362
by: Alberto | last post by:
Eh unfortunately Google groups does not provide any longer a way to reply to the group for older posts (though the one I am referring to is not older than one month), and I happen to come back to...
5
2115
by: emma_middlebrook | last post by:
Hi I've found the rules that cover what is a valid attribute name here: http://www.w3.org/TR/2006/REC-xml-20060816/ 2.3 Common Syntactic Constructs Is there anything already in the dotnet...
18
2932
by: John Salmon | last post by:
I was under the impression that the following was always valid: std::vector<Tv; .. T *p = &(v); But I was recently told that care was needed in case the vector was empty, i.e., when v.size()...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.