C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 3)
3.
Which of the following statements is correct?
Discussion:
41 comments Page 2 of 5.
Pradeep said:
1 decade ago
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.
VINOD said:
1 decade ago
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.
Hemanth said:
1 decade ago
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.
Shivam said:
1 decade ago
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:
1 decade ago
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.
Priya said:
1 decade ago
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.
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.
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:
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.
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.
Mahejbin said:
10 years ago
Extending the base class by name so the derived class know which data we are using maybe derived class point to the base class.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers