inheritance - Why C# does not allow abstract methods in non abstract class? -



inheritance - Why C# does not allow abstract methods in non abstract class? -

i have base of operations class has "mock" method used in same way inherited classes

protected class user{ protected void prepareuser() { // init } protected abstract display(); } public class person: user{ // override display }

my problem of course of study can't declare abstract methods in non abstract class right oop approach have base of operations class init method triggered in same way , forcefulness inherited classes re-implement display method?

first of can have abstract class method implementation bellow:

protected abstract class user { protected void prepareuser() { // init } protected abstract void display(); }

secondly cannot have protected class if not within other class. base of operations class cannot less accessible subclass. total working code should like:

namespace mynamespace { public class xxx { protected abstract class user { protected void prepareuser() { // init } protected abstract void display(); } protected class person : user { protected override void display() { //something } } } }

c# inheritance

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -