physics chemistry maths science forums
become expert I help I sign up I login
refer a friend - earn nickels!!   
 advanced
 
Home
Ask & Discuss Questions
Study Material
Experts Zone
Hang Out!

Ask & Discuss Questions with Community & Experts

Moderation Team
 90 chars left    advanced
Ask iit jee aieee pet cbse icse state board community Community Discussion Question: inheritance??
Forum Index -> Computer Science like the article? email it to a friend.  
Author Message
v_gurucharan (278)

Blazing goIITian

Olaaa!! Perrrfect answer. 46  [70 rates]

v_gurucharan's Avatar

total posts: 459    
offline Offline
can a derived class constructor or function use a base class variable??

can a derived class object use publicly derived variable of  base  class???
    
varshavallig (798)

Blazing goIITian

Olaaa!! Perrrfect answer. 136  [195 rates]

varshavallig's Avatar

total posts: 509    
offline Offline
edited!!!
1. no, the variabl if private, will be a member of the class. it will b visible but u cannot use it in derived class!!!!
2. s it can be done, provided the variable is public to the base class also.
!!!!!!!!!!!!!!!!!

Varsha
be cool,
tomorrow is what we make it today,
so if u can dream it , u can make it .
life is an ice cream ,eat it before it melts away!!!!!!!!!
varsha

SmileyCentral.com




 this reply: 5 points  (with Olaaa!! Perrrfect answer.   in 1 votes )   [?]
 
You have to be logged on to rate
  
ramkumar_november (1266)

Blazing goIITian

Olaaa!! Perrrfect answer. 230  [288 rates]

ramkumar_november's Avatar

total posts: 406    
offline Offline
1. the base class variable is in private section ....... we cannot use it in derived class since private members of a class are not inherited......

if the base class variable is in protected or public section we can use it in derived class........

2. it depends on the visibility mode......if the visibility mode is such that the base class variable is in the public setion of the derived class then the derived class object can use that variable.....



 this reply: 0 points  (with Olaaa!! Perrrfect answer.   in 0 votes )   [?]
 
You have to be logged on to rate
  
 
Forum Index -> Computer Science
Go to:   

Top Offers for goIITians
Correspondence Courses
Brilliant Tutorials
Narayana Institute
Aakash Institute
Classroom/Crash Courses
Narayana - Kota , Delhi , Others
Brilliant Tutorials - Class , Crash
Aakash Institute - Medical , Engg
Online Test Series
Brilliant Tutorials
Narayana Institute
Aakash Institute
Mahesh Tutorials
AMITY      Sri Chaitanya