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
Why are local variables stored in stack?
What is a scope in c#?
What is static and use of it?
What is the data type for bit in c#?
Can constructor have return type c#?
What are primitive types in c#?
Define property in c#.net?
Please explain value types and reference types used in c#?
Are c and c# the same thing?
How do you define a predicate?
How many types of constructors are available in c#?
What is data annotation in c#?
What is difference between dictionary and list in c#?
What is scaffolding in c#?
When should we use delegates in c#?