File tree Expand file tree Collapse file tree
source/code/projects/Computer/Computer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ class Computer {
2+ private string brand ;
3+ public void SetBrand ( string brandP ) { brand = brandP ; }
4+ public Computer ( string bP ) { SetBrand ( bP ) ; }
5+ public override string ToString ( ) { return $ "Brand: { brand } "; }
6+ }
Original file line number Diff line number Diff line change 1+ class Laptop : Computer {
2+ public int ScreenSize { get ; set ; }
3+ public Laptop ( int ssP , string bP ) : base ( bP ) { ScreenSize = ssP ; }
4+ public override string ToString ( ) { return base . ToString ( ) + $ "\n Screen size: { ScreenSize } \" "; }
5+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ public class Program {
4+ public static void Main ( ) {
5+ Computer test1 = new Computer ( "Framework" ) ;
6+ Console . WriteLine ( test1 ) ;
7+ Laptop test2 = new Laptop ( 12 , "ThinkPenguin" ) ;
8+ Console . WriteLine ( test2 ) ;
9+
10+ }
11+
12+ }
You can’t perform that action at this time.
0 commit comments