Discussion :: OOPS Concepts - General Questions (Q.No.3)
|Deepak Tak said: (May 18, 2012)|
|Because its top-down approach.|
|Srikanth said: (May 23, 2012)|
|The statement is correct because, derived class has no knowledge of its parent.|
|Vinod said: (Jul 2, 2012)|
|Already derived from that class only, so this can use that class directly, again why to point. So to avoid this efficiency problem language developers already created in that way.|
|Kavita said: (Jul 12, 2012)|
|I agree with srikant! there is no way a pointer should be able to point to an object of its parent class type because derived class not know anything about the new members that might have declared in parent class.|
|Yogesh said: (Aug 6, 2012)|
|I totally agree with Vinod. Derived class object can access members of base class[Depending upon type of inheritance], so need to do that, because C++ Developers have developed compiler in this way only.|
|Shivam said: (Aug 22, 2012)|
|When base class is made as virtual then only derived class pointer points to the base class otherwise derived class pointer can't point to the base class.|
|Neeraj Raghav said: (Sep 4, 2012)|
|Because base class allready has its pointer n with this pointer we can access the derived class so no need to declare a pointer in derived class.|
|Nilam Patel said: (Sep 21, 2012)|
|Derived classes are derived from their base class so base class has total knowledge of it's derived class n can able to point them but derived class has no ability to point to its base class. Because it's a top down approach.|
|Hemanth said: (Oct 4, 2012)|
|There is no need of derived class to point to its base class or to it's parent class as it is inherited from it and it would be quite violating the property of inheritance.|
|Pradeep said: (Oct 30, 2012)|
|Whether Virtual Function is available or not, derived class pointer is not required at all. When base class pointer is created, both the members from base and derived can accessible from it.|
|Souradip said: (Nov 8, 2012)|
|The actual reason is - a derived class has all information about a base class and also some extra bit of information. Now a pointer to a derived class will require more space and that is not sufficient in base class. So the a pointer to a derived class cannot point to it. While on the other hand the reverse is true.|
|Kaustav said: (Dec 10, 2012)|
|Down casting possible, up casting not possible.|
|Nambiar Sreeram Ramesh said: (Mar 14, 2013)|
I am totally agree with you. Because it is not at all possible that the base class holds the contents of derived class.
|Sravani said: (Oct 7, 2013)|
|Base class has capability to create pointer. Derived class is derived from base class only so it is also has access that pointer.|
|Sneha Kuwar said: (Jan 20, 2014)|
|Because derived class does not have detailed about its based class.|
|Abhinav said: (Feb 27, 2014)|
|Yeah sure its not necessary to do this but we can assign base class object's address to a derived class pointer by typecasting.|
|Satya said: (Mar 11, 2014)|
|I agree with @Sneha kuwar because derive class does not have any knowledge about its base class.|
|Danunjaya said: (Mar 30, 2014)|
|Hi guys. But using static_cast<> we can assign base class pointer to derived class pointer.|
|Shelvane Baburao said: (May 15, 2014)|
|Can you give me example of static_cast<> to assign base class pointer to derived class.|
|Fayaz said: (May 30, 2014)|
|Why option D is not correct?|
|Ashwini said: (Jun 6, 2014)|
|To give derived class pointer to base class object will be down_casting.
And compiler doesn't allow to downcast any pointer.
|Bhavna said: (Aug 27, 2014)|
|Derived class is a child class and base class is like parent to that.|
|Lav Kumar said: (Oct 3, 2014)|
|Derive class is the derived one and there is no link with the base class there.|
|Jyothi said: (Oct 22, 2014)|
|Being a static cast basic class have can assign base class pointer to derived class pointer.|
|Wele Suda said: (Jun 1, 2015)|
Take NO, C++ is OO language, so it has bottom-up approach, not top-bottom.
|Priya said: (Jul 3, 2015)|
|Derived class is the class already inherited from base class. So, there is no need for derived class to point the base class. As I thought so.|
|Prashant said: (Jul 4, 2015)|
|Then what is up casting?|
|Sandep said: (Jul 28, 2015)|
|There points and all the doubts will be cleared.
1) in top-down approach will can't do up casting where as reverse is possible.
2) As derived class has inherited there is no need for pointing to the base class object.
3) In top-down approach the derived class does not no about the base class do pointing to the base class is not possible using the pointer of derived class.
|Divya said: (Aug 10, 2015)|
|Why D is not correct? Is we create pointer for base class?|
|Thazaar said: (Sep 11, 2015)|
|It is a top down approach. So derived class pointer cannot point to the base class.|
|Kazi Ameen said: (Oct 5, 2015)|
|It is just because of the top-down approach.|
|Mahejbin said: (Oct 22, 2015)|
|Extending the base class by name so the derived class know which data we are using maybe derived class point to the base class.|
|Preeyanka said: (Dec 12, 2015)|
|Base class pointer can point to base class object and derived class objects. To access base part, which is in derived class, base class uses its pointer. So vice versa is not their. i.e their is no derived class part in base class, so derived class pointer cannot access base class.|
|Yash said: (May 24, 2016)|
|Hierarchy is the base class to derived class.
Controls call base class first and then derived class.
So, there is no point a derived class would point a base class unless base class is "virtual".
|Nayan said: (Sep 13, 2016)|
|I do not agree with this. Just because it can be done in down casting by dynamic_cast.|
|Ari said: (Jun 8, 2017)|
|Yes, you are Right @Nayan.
Down Casting is way to point base class by derived class pointer.
|Priya Modak said: (Jan 23, 2018)|
|I agree because it is a top-down approach.|
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.