Yes, you can derive a class from abstract class the code is given below. write a abstract class with abstract function and drive a class from this abstract class and override the abstract method in derive class and give implementation. while calling this method you need to create instance of derive class only because parent class don't have any implementation.
Code to derive a class from abstract class:
using System;
namespace MyApp
{
public class abstract_derived_class
{
public static void Main(string[] args)
{
derived_class obj = new derived_class();
obj.my_method();
Console.ReadLine();
}
public abstract class abstract_class
{
public abstract void my_method();
}
public class derived_class : abstract_class
{
public override void my_method()
{
Console.WriteLine("Derived Class Method.");
}
}
}
}
Some questions I got in my technical discussion round.
ReplyDeletepublic classA
{
fun (){"A";}
}
public classB :ClassA
{
fun (){"B";}
}
A a = new B();
a.fun();
Out put "A";
----------------
public classA
{
virtual fun (){"A";}
}
public classB :ClassA
{
override fun (){"B";}
}
A a = new B();
a.fun
Out put "B";
----------------
============================
Sealed Method
=============================
Method Name Implicit Typing
=============================
What is purpose of System.Object?
This allows C# built-in types to be worked with in a manner similar to reference types. From an object-oriented
perspective, under Type System Unification both reference types and value types are objects.
==================================
Dependency Property Vs Normal Property
Either can be used , except in case of animatable properties
As far as I know, DependencyProperty is only required when you need
1.PropertyValue inheritence
2.you need to allow the property to be set in Style setters
3.Use animation for the property
============================================
Commanding Vs Eventing
Commands provide two main benefits over event handlers:
1.commands are not linked to the caller,
so same command is not dependent and can be called from menu item, toolbar button, keyboard, etc.
2.commands provide support for enabling/disabling