c# - Instance of an abstract class not working -
i'm sure many of mark repeaed second see title. please bear me..facing complicated issue. :)
thanks reading till here :d
so, have class called infoclass, abstract-
public abstract class infoclass { public abstract string brand { get; set; } public abstract string brandcount { get; set; } } i have service in i'm making list out of it..and down line tryin make instance of same. not able to-
[webmethod] public void getinfolist() { list<infoclass> listinformations = new list<infoclass>(); . . . //going ahead in program i've created reader . . . . while (rdr.read()) { //this block not working infoclass advertises = new infoclass(); advertises.brand = convert.tostring(rdr["brand"]); } please me out alternative code. i'm sure class meant abstract, cant change on class level.
i'm used more java, things seem similar c#.
abstract classes can't instanciated can see in documentation
they classes cannot instantiated, , either partially implemented, or not @ implemented.
thus new infoclass(); not valid. have either make infoclass not abstract, or create class inherits infoclass , instanciate it.
Comments
Post a Comment