I am implementing library system as Exercise, in that I have created one abstract class :
public abstract class RentalItem
{
.....
public RentalItem() { }
public RentalItem(string itemID, string title, int qty,float price, PeriodType period) {
ItemID = itemID;
Title = title;
No_Of_Copies = qty;
Period = period;
}
public abstract void addItem(string itemId, string title, int no_of_copies,float price,PeriodType p);
.....
}
Afterwards, I have created MovieItem class, which inherits RentalItem class : now this class has extra fields. as below :
public Movie(string itemId, string title, int no_of_copies, float price, PeriodType p, MovieType type, string actor, string director)
: base(itemId, title, no_of_copies, price, p)
{
this.Type = type;
this.Actors = actor;
this.Director = director;
}
public override void addItem(string itemId, string title, int no_of_copies,float price,PeriodType p){};
But actully I want to implement addItem method such away, it takes base parameters + additional parameters as below :
public void addItem(string itemId, string title, int no_of_copies, float price, PeriodType p, MovieType type, string actor, string director)
So how can I use abstract method? And if I am implementing my own addItem(...) method then what is use of abstract class ?