Ravi Kumar
Suppose, We have class A and class B having same method. class B inheriting from A. class A not defined virtual that method but Class B define override, then what will happen?
By Ravi Kumar in OOP/OOD on Jan 07 2016
  • Ravi Kumar
    Jan, 2016 7

    Program will not compile generate error like; Error: Class B cannot override inherited member 'Class A' because it is not marked virtual, abstract, or override.

    • 10
  • Sweta Shetye
    Dec, 2016 4

    It will give a compilation error. Error : 'ClassB.Function()': cannot override inherited member 'ClassA.Function()' because it is not marked virtual, abstract, or override

    • 4
  • Vishal Jadav
    Aug, 2016 8

    Method of class A is hidden now and method of class B is invoked when called.

    • 4
  • Prakash Tripathi
    Apr, 2016 11

    You can only override the virtual methods.

    • 4
  • Rahul Sharma
    Oct, 2016 18

    it will give compilation error...

    • 3
  • Chaitanya Reddy Vonaja
    May, 2016 20

    No Suitable method found to override

    • 3
  • Nilesh Patel
    Sep, 2016 19

    I think you must be create virtual method in Class A than you will be use override method in derived class with out it Compilation Error is occur.

    • 2
  • Puneet Kankar
    Sep, 2016 10

    Error : cannot override inherited member ,because it is not marked virtual, abstract, or override.

    • 2
  • Hiren Parmar
    Aug, 2016 14

    metod overiding

    • 2
  • Prashant Singh
    Mar, 2016 19

    In C# virtual is just optional...still it ovveride the method present in classB

    • 2
  • Dheeraj Kumar Jha
    Mar, 2016 14

    here throw Exception, bcz, if base class have member method which does not marke as a virtual or abstract so compiler does not allow we go for in derived class a override that member method which is non virtual or non abstract.so if we want override those method then we have must go for that member method mark as a virtual or abstract. keep in mind.

    • 2
  • Prakash kesharwani
    Jul, 2019 6

    B.SomeMethod(): cannot override inherited member ‘A.SomeMethod()’ because it is not marked virtual, abstract, or override

    • 1
  • Prakash kesharwani
    Jul, 2019 6

    B.SomeMethod(): cannot override inherited member ‘A.SomeMethod()’ because it is not marked virtual, abstract, or override

    • 1
  • Bharatbhushan Sharma
    Feb, 2018 25

    It will give compilation error Class B cannot override inherited member 'Class A' because it is not marked virtual, abstract, or override

    • 1
  • Mukesh Kumar
    Aug, 2017 29

    an warning is shown

    • 1
  • Mohsin Mukri
    Jul, 2017 6

    will throw the exception "cannot override inherited member bcoz it is not marked as virtual in a parent class

    • 1
  • Dheeraj Kumar Jha
    Mar, 2016 14

    here throw Exception, bcz, if base class have member method which does not make as a virtual or abstract so compiler does not allow we go for in derived class a override that member method which is non virtual or non abstract. keep in mind.

    • 1
  • shyam barnwal
    Feb, 2020 9

    error

    • 0
  • Sonia D
    Sep, 2019 5

    Override properties of base class a

    • 0
  • Jeet Agrawal
    Jul, 2018 4

    ClassB.Function() cannot override inherited member ClassA.Function()' because it is not marked virtual, abstract, or override

    • 0

Most Popular Job Functions


MOST LIKED QUESTIONS