2.
internal class Piston {}
internal class Engine
{
private Piston[] myPistons = new Piston[4];
public bool Ignition() {
//some code
}
}
public class Car
{
private Engine myEngine = new Engine();
public void Start()
{
//put in keys etc..
if (myEngine.Ignition()) {
//some more code
}
}
What OO concept does the above sample code demonstrate?
View Description
In computer science, object composition (not to be confused with function composition) is a way and practice to combine simple objects or data types into more complex ones