function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sekhar raj 4sekhar raj 4 

Abstract class cannot be constructed

public abstract class cellshop
{
public cellshop() 
{
system.debug('jjjjjj');
}
private abstract void cost();
void change()
{system.debug('iiiii');}
 class ab extends cellshop
{
private override void cost()
{system.debug('cell cost7872');
}
}
}
James LoghryJames Loghry
Sonam explains it really well in this post: https://developer.salesforce.com/forums/?id=906F000000093W8IAI

To summarize,
  1. Abstract classes contain abstract method (signatures) which are not implemented.  Abstract classes themselves cannot be constructed, but must be extended by a subclass for constructing an instance thereof.
  2. Virtual classes are very similar to abstract classes, but you can implement the methods, construct virtual classes, but at the same time override methods in the virtual class using extends and sub classes.
If you're interested here's another article on how you can utilize abstract classes and interfaces together: 
James LoghryJames Loghry
So to construct your class, you'll need to change it to a virtual class instead, or extend the abstract class and construct the sub class instead.