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

What does console writeline do?

12


Write the syntax for catching an exception in c#?

28


What is the difference between struct and class c#?

20


Explain briefly the difference between value type and reference type?

87


How to update the gui from another thread in c#?

36






What is difference between int and int32 in c#?

15


What is string concatenation?

18


When a switch is said to be congested?

67


Can we inherit abstract class in c#?

26


What is a reference type c#?

11


How to get the sum of last 3 items in a list using lambda expressions?

36


What does an indexer do?

23


Why do we use lambda expression in c#?

23


What is datagridview in c#?

8


What is difference between internal and protected internal in c#?

12