Look at the error message, and at your code:
main.cs(31,10): error CS1520: Class, struct, or interface method must have a return type
main.cs(31,10):
This means the error is on line 31, column 10, of the file "main.cs"
So look at that line:
29. class Laptop:LaptopBase
30. {
31. public LaptopBase(String LaptopName):base(LaptopName)
32. {
33. this.LaptopBase=LaptopName;
That's a constructor: but it's a constructor of the base class, not the actual class. As a result, your get this error:
error CS1520: Class, struct, or interface method must have a return type
Because you can
only create a constructor in the class that it refers to.
Probably, you need to declare a
Laptop
constructor, not a
LaptopBase
- which would get rid of that error, but...
1) LaptopBase is a class, not a variable, so you can't assign a string to it.
2) Declaring the base class as part of the class that derives from it is ... um ... odd. Very odd. How do you expect other classes to easily derive from LaptopBase if it's part of the Laptop class?
I think you need to rethink what you are trying to do here, and reread your course notes - that code very much looks like the "guess and hope it works" school of coding, and that isn't a good design strategy!