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.

Fayaz said:   1 decade ago
Why option D is not correct?

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

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.

Abhinav said:   1 decade ago
Yeah sure its not necessary to do this but we can assign base class object's address to a derived class pointer by typecasting.

Sneha kuwar said:   1 decade ago
Because derived class does not have detailed about its based class.

Sravani said:   1 decade ago
Base class has capability to create pointer. Derived class is derived from base class only so it is also has access that pointer.

Nambiar Sreeram Ramesh said:   1 decade ago
@Souradip.

I am totally agree with you. Because it is not at all possible that the base class holds the contents of derived class.

Kaustav said:   1 decade ago
Down casting possible, up casting not possible.


Post your comments here:

Your comments will be displayed after verification.