| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|||||||
| ds. c , c++ Interview / Technical Questions Kindly solve an many as questions you can. It will sharpen your skills and those solutions will help others too. |
![]() |
|
|
LinkBack | Thread Tools | Rate Thread | Display Modes |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Sep 2007
Age: 25
Posts: 16
Thanks: 1 Thanked 0 Times in 0 Posts Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 2
|
#include<stdio.h>
#include<conio.h> #include<iostream.h> class sample { sample()//sample constructor declared in private part { a=10; } int a; static sample*pp; public: static sample* create() { pp=new sample;//creating sample class object return pp; } void show() { cout<<a; } }; class derived:public sample { int x; public: derived() //derived constructor declared in public part { //how to access the base class' "sample" constructor x=20; //here...the error is present here..cannot access } // base class constructor }; sample* sample::pp; void main() { derived obj1;//creating derived object getch(); } /* my question is ..this program will not compile because we cannot access the base class' (here is sample) constructor because it is declared in private part in base..then HOW CAN WE CRATE AN OBJECT OF DERIVED CLASS..i tried a lot but cannot find the solution..actually this is possible or not..do not try this program to run in turbo or vc++ compiler.because you cannot create private constructor in these..but private constructor is possible in unix,linux c,c++*/ |
|
|
|
|
|
#2 (permalink) |
|
Junior Member
Join Date: Aug 2007
Age: 25
Posts: 16
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2
|
Re: How to access the base constructor???
This is really a gud Question and I believe u only has given the (Hidden)answer wid it.
Because thats the speciality of Obj-Oriented programming, there will enough security and there will not be any free-flow of data unless the programmer desires it...Hence the inclusion of Access Specifiers (Private, Public, Protected). While these features are not involved in unix, linux.... Do correct me if I am wrong... |
|
|
|
|
|
#3 (permalink) |
|
Junior Member
Join Date: Sep 2007
Age: 25
Posts: 16
Thanks: 1 Thanked 0 Times in 0 Posts Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 2
|
Re: How to access the base constructor???
dear sajishk
in most of the software companies they are using unix or linux. how can u say these features(private,public,protected) are not involved . all r available with unix,linux. |
|
|
|
|
|
#4 (permalink) |
|
Junior Member
Join Date: Aug 2007
Age: 25
Posts: 16
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2
|
Re: How to access the base constructor???
Gouriproutray,
Oh!! reallly so.....If that is the case then I must thnk you to pass this piece of info into me .... |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mega Free Download S/W Links A-Z | yathish | OTHERS | 513 | 30-09-08 02:49 PM |
| Bob Technologies placement paper 2 | sridhar | BOB TECHNOLOGIES Placement Papers | 0 | 03-02-07 07:43 PM |
| Bob Technologies placement paper 1 | sridhar | BOB TECHNOLOGIES Placement Papers | 0 | 03-02-07 07:42 PM |
| Calls to India and other International destinations just got even cheaper!!! | AjayKumar.Kataram | Amazing TIPS & TRICKS | 2 | 09-12-06 03:40 PM |
| JAVA collection | naga | JAVA Technologies | 0 | 21-02-06 06:01 AM |