Monday, 19 July 2010
Constructors in C#
http://www.c-sharpcorner.com/UploadFile/puranindia/LearningConstructorsInC-sharp05182009044452AM/LearningConstructorsInC-sharp.aspx
Wednesday, 14 July 2010
polymorpihsm
polymorpihsm ->one name, many form.
have 2 types : 1. Compile time, 2 Run time
1 compile time: also called overloading
have 3 types. 1. Constructor overloading(i.e.,with same constructor name and different no of arguments or different datat types or both ) 2 Function overloading(i.e.,with same function name and different no of arguments or different datat types or both)
3. operator overloading: exaample : String s = "James";
s = s + "Bond";
Runtime poly: is achieved by overridding parent class method:
This is called Dynamic method dispatch.
1. function overloading,
2. Runtime polymorphism --Using Interface reference,
EX:
interface name I ,abstract Method();
implimenting classes A,B
ref I;
objA= new A();
objB= new B();
runtime
objA=I
objA.Method();
objB=I;
objB.Method();
have 2 types : 1. Compile time, 2 Run time
1 compile time: also called overloading
have 3 types. 1. Constructor overloading(i.e.,with same constructor name and different no of arguments or different datat types or both ) 2 Function overloading(i.e.,with same function name and different no of arguments or different datat types or both)
3. operator overloading: exaample : String s = "James";
s = s + "Bond";
Runtime poly: is achieved by overridding parent class method:
This is called Dynamic method dispatch.
1. function overloading,
2. Runtime polymorphism --Using Interface reference,
EX:
interface name I ,abstract Method();
implimenting classes A,B
ref I;
objA= new A();
objB= new B();
runtime
objA=I
objA.Method();
objB=I;
objB.Method();
Tuesday, 6 July 2010
Can we call a base class method without creating instance?
Its possible If its a static method.
Its possible by inheriting from that class also.
Its possible from derived classes using base keyword.
Its possible by inheriting from that class also.
Its possible from derived classes using base keyword.
You have one base class virtual function how will call that function from derived class?
class a
{
public virtual int m()
{
return 1;
}
}
class b:a
{
public int j()
{
return m();
}
}
Class a
Public Overridable Function m() As Integer
Return 1
End Function
End Class
Class b
Inherits a
Public Function j() As Integer
Return m()
End Function
End Class
{
public virtual int m()
{
return 1;
}
}
class b:a
{
public int j()
{
return m();
}
}
Class a
Public Overridable Function m() As Integer
Return 1
End Function
End Class
Class b
Inherits a
Public Function j() As Integer
Return m()
End Function
End Class
Subscribe to:
Posts (Atom)