Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

There are a class A. Another class B derived from it.
Now if I do A a = new B(); and B b = new B(); What will
happen in both the statements. And what is the difference
between these two statements.

Answer Posted / ashok kumar

A is a base class, B is a derived class.
Which means we cad access all the data of A class in B class.

Public A
{...}
Public B:A
{...}
Class VoidMain()
{
A a=new B();// Creating object for A class(can access the A
class data only).
B b=new B();// Creating object for B class(can access the
A,B class data).
}

Is This Answer Correct ?    12 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you inherit from multiple classes in c#?

831


What is use of abstract class in c#?

880


Why do we use yield in c#?

863


How do you achieve polymorphism in c#?

844


What is difference between private and protected in c#?

893


What is get set in c#?

918


How many types of constructors are there in c#?

903


What is an enumerator in c#?

901


What is a partial class. Give an example?

914


What is state c#?

809


What is sorted list in c#?

843


If you want to convert a base type to a derived type, what type of conversion do you use?

884


Explain About CLS?

914


Explain how do I convert a string to an int in c#?

917


The int maps to which C# keyword in .NET type?

983