Created
December 7, 2012 19:14
-
-
Save yeahunter/4235675 to your computer and use it in GitHub Desktop.
Suli - Osztályok 2012/12/07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace suli_osztalyok | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Ember Buczkó = new Ember(18, "fekete", "David"); | |
Buczkó.bemutatkozik(); | |
Ember e2 = new Ember(17, "világos barna", "Kovács Elemér"); | |
e2.bemutatkozik(); | |
Négyzet n1 = new Négyzet(5); | |
n1.Kerület(); | |
n1.Terület(); | |
Téglatest T1 = new Téglatest(4, 5, 6); | |
Téglatest T2 = new Téglatest(4, 5, 6); | |
T1.Hasonló(T2); | |
} | |
} | |
class Ember | |
{ | |
private int kor; | |
public string hajszin; | |
public string nev; | |
public bool felnott; | |
public void bemutatkozik() | |
{ | |
Console.WriteLine("Nevem: {0}", nev); | |
Console.WriteLine("Korom: {0}", kor); | |
Console.WriteLine("Hajam színe: {0}", hajszin); | |
if (felnott) | |
Console.WriteLine("És már sört is vehetek a boltban."); | |
else | |
Console.WriteLine("És még nemvehetek sört a boltban."); | |
} | |
public Ember(int kor, string hajszin, string nev) | |
{ | |
this.kor = kor; | |
this.hajszin = hajszin; | |
this.nev = nev; | |
felnott = kor >= 18; | |
} | |
} | |
class Négyzet | |
{ | |
int aoldal; | |
int kerület; | |
int terület; | |
public Négyzet(int a) | |
{ | |
this.aoldal = a; | |
} | |
public void Kerület() | |
{ | |
this.kerület = 4 * this.aoldal; | |
Console.WriteLine("Kerület: {0}", this.kerület); | |
} | |
public void Terület() | |
{ | |
this.terület = this.aoldal * this.aoldal; | |
Console.WriteLine("Terület: {0}", this.terület); | |
} | |
} | |
class Téglatest | |
{ | |
int aoldal; | |
int boldal; | |
int coldal; | |
int felszin; | |
int terfogat; | |
public Téglatest(int a, int b, int c) | |
{ | |
this.aoldal = a; | |
this.boldal = b; | |
this.coldal = c; | |
} | |
public void Térfogat() | |
{ | |
} | |
public void Felszín() | |
{ | |
// double 2 * (aoldal * boldal + aoldal * coldal + boldal * coldal); | |
} | |
public void Hasonló(Téglatest teglatest) | |
{ | |
if (teglatest == this) | |
Console.WriteLine("Hasonló"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment