C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 3)
3.
Which of the following statements is correct?
Base class pointer cannot point to derived class.
Derived class pointer cannot point to base class.
Pointer to derived class cannot be created.
Pointer to base class cannot be created.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
41 comments Page 3 of 5.

Ashwini said:   1 decade ago
To give derived class pointer to base class object will be down_casting.

And compiler doesn't allow to downcast any pointer.

Danunjaya said:   1 decade ago
Hi guys. But using static_cast<> we can assign base class pointer to derived class pointer.

Satya said:   1 decade ago
I agree with @Sneha kuwar because derive class does not have any knowledge about its base class.

Ari said:   8 years ago
Yes, you are Right @Nayan.

Down Casting is way to point base class by derived class pointer.

Shelvane Baburao said:   1 decade ago
Can you give me example of static_cast<> to assign base class pointer to derived class.

Jyothi said:   1 decade ago
Being a static cast basic class have can assign base class pointer to derived class pointer.

Nayan said:   9 years ago
I do not agree with this. Just because it can be done in down casting by dynamic_cast.
(1)

Wele Suda said:   1 decade ago
@Deepak.

Take NO, C++ is OO language, so it has bottom-up approach, not top-bottom.

Thazaar said:   10 years ago
It is a top down approach. So derived class pointer cannot point to the base class.

Srikanth said:   1 decade ago
The statement is correct because, derived class has no knowledge of its parent.


Post your comments here:

Your comments will be displayed after verification.