Car car = new Car();

>Car car = new Car();

what are the fields

exit(1)

String color = input.nextLine();
Double mpg = input.nextDouble();

var car = new Car();

string car = "Car"
Car::Car car = new Car::Car(car)

(cons 1 (cons 2 (cons 3 nil)))

Shit change string car to Car

Car car = new Car();

print car

Car::Car car = new Car::Car()

The beauty of C++

>std::unique_ptr car = std::make_unique();

auto mobile = old Car();

var car = { "var" : "car" }

first month of programming ever I remember writing
// create blue box
String box = new String("blue");

found that quiz recently and had to sit down and reflect for a while

typedef Car Shit;

Shit car { 1995, "Toyota", "Camry" };

a modern version would be
std::unique_ptr car = std::make_unique();

In Swift:
var car = Car()

And her comes python, BTFOing all of the other languages
Car = car

90s Toyotas were good though

wut

10 PRINT "CAR"
20 GOTO 10

Yeah, but I didn't have it in the 90s.

if __name__ == Car()

*errors at runtime*

def Car():
return __main__
if __name__ == Car():

There, problem solved

well done

I know right? why the fuck would you do this? how did this ever become so popular?

$car = ['wheel' => true];

Nice

let mut car = std::rc::Rc::new(std::cell::Refcell::new(std::boxed::Box::new(Car::new())))))

Car car = Cars.createNewCar();

car_t *car = (car_t *) malloc(sizeof(car_t))

>Cars
hmm

Lmao I love this meme

>when you name a car "car"

COME OFFIT LAD

And this is why I use C and not all these other meme languages!

memes aside, why is this bad?

Car car1 = new Car();

>he casts the result of malloc

can someone explain to me why object oriented programming is a thing, i have just started learning java and dont see a use case like why use an object when you can just store the same stuff in an array

>encapsulation
>composition
>polymorphism

post POST= new post1.(post1);

fuck it, just going to farm

Object-oriented programming?
do you mean, Car::Car Car-oriented programming?

car: Car = new Car();

CarFactory carFactory = new CarFactory("Car Factory");
Car car = CarFactory.createNewCar("Car");

var car = Car()

>you can just store the same stuff in an array

arrays can only have one data type

I now have aids, thanks

polymorphism was a little tricky to understand but now its my favorite.

"Car car;" declares an object and "car = new Car()" initializes it, is that how it works?

Easy to subdivide your code into smaller pieces that do one job well and don't care about other pieces. Of course if your architecture is shit you'll end up with a procedural abomination of tightly coupled code.

> (car (car '((new) car)))

>tfw you actually code like this

One of the biggest problems in programming is dealing with different "states". If your program got the correct input you are supposed to be in a differnt state than without correct input, if you sort an array you are changing state with every iteration and so on.
Now ther are two major concepts of dealing with this problem.

Functional programmign tries to avoid state as much as possible by making data structures immutable and only operates through functions. If you have immutable datastuctures there's no need to hide information, because ideally there's nothing that can even crash because all function use the same inout values at any given state, only the operating functions make it a different state.

OOP takes a different approach, it encapsulates state within objects by (partially) hinding functions and data structures in itself. Those objects may or may not tell other objects what their state is and may or may not provide methods to change their state from the outside.


You can solve every problem with both approaches, but both approaches have good and bad parts. So it depends pretty much much on the nature of the problem where one approach makes sense.

Functional programming makes it a breeze to let things happen at the same time. And it's also very comfortable to add functions. But if you find out that you have to change the underlying datastuctures you can run into alot of trouble and might have to fix or rewrite all those functions and proceses.


Object oriented programming makes it easy to add/remove underlying data structures. From the outside view it doesn't matter what happens inside the object or where those data come from. But if you have to change behaviour it can be a pain in the rear, because if you change one object you have to think about what it means for it's child classes, change interfaces, add/remove other methods to make it work and so on.

car is a car.

CAR CAR CAR CAR CAR CAR CAR CAR CAR CAR CAR CAR CAR CAR CAR CAR

let car: Car = Car::new(make, model, mpg, hp);

Underrated

public static ListenatbleFuture chain(ListenableFuture input,
Function

The fuck is this supposed to do? Java makes no fucking sense

wow
patrician

var : = ()

var 車 カー = 車()

A lot of people made a lot of money pushing OOP to witless businesses

create an object car of Car class.
You have to be retarded not to understand this and it has nothing to do with java.

can you ever do:
ClassA objectname = new ClassB(); ?

Nignog nignog=new Nignog("nignog", "nig", "nog") ;

technically yes(?) if both objects have sub-variables with the same identifiers. e. g. nig.nog="nignog" and nog.nog="nig"

Nig nig=new Nog("nig")
Nog nog=new Nig("nog")

import car

Some things are easier.
Check out Algorithms 4th edition by Sedgewick, it's the only worthwhile Java textbook
As an exercise for yourself, try implementing all of the programs in the book in a different language like C. You'll figure out which stuff is easier and which stuff is harder with OOP.

Create a pointer to a Car object, the pointer is stored in a variable named car. Initialize that pointer to a new Car object created with the default constructor, (Allocate memory for a Car object on the heap).
It's really simple

>He needs to manually allocate space for a Car-sized object
>He needs to manually allocate space for an object
>He needs to manually allocate space
>He needs to do things manually

class Car extends Vehicle implements Drivable {
@SuppressWarnings("CO2Emissions")
@Override
public Integer getWheels() throws WheelsNotFoundException {
return super.onboardComputer.getInstalledWheels();
}
}

>impements Drivable

It isn't manual allocation. The JVM knows how much memory to allocate for a Car without you explicitly telling it, and the GC will free the memory as soon as the "car" pointer points to a different object or it goes out of scope.

I don't get it.

The JVM doesn't know shit. The compiler knows how much memory to allocate.

yes

we need a car version

That's bullshit. I'm a C# dev, not Java, but I know Java isn't so garbage that you can't create an interface variable and assign to it with a runtime cast.

In C#:
//Somewhere
Object someObject = new PrettyBigCar();

//Somewhere else.
ICar smolCar = someObject as ICar;


The car variable could be storing anything that impliments ICar. The compiler has no way of knowing if the cast will work at runtime. In fact the "as ICar" is only really there to tell the compiler "hey I got this, the cast will totally work". Without it, you'd get an error that an implicit cast from Object to ICar can't be done.

nope don't get it

>be c++ guy
>to inteligent to understand c#

auto car = Car();

YOU WOULDN'T
MALLOC A CAR

this

CarFactoryFactory carFactoryFactory = CarFactoryFactory.getInstance();
if (carFactoryFactory != null) {
CarFactory carFactory = carFactoryFactory.createCarFactory("CarFactory", CarFactory.class);
if (carFactory != null) {
Car car = carFactory.createCar("Car", Car.class);
if (car != null && car.hasProperty(new Property("Wheel"))) {
car.drive();
}
}
}

really good reply user

Python is beautiful
new_car = Car()

>he can't into OOP

(car (cons x y))
>x

Nah, factories have no valid reason to exist, when you have Reflection APIs to solve the same problem more elegant and actually more robust with less need to change the code every time you add a new class.

Car[] cars = {car1 = new Car(1), car2 = new Car(2), car3 = new Car(3)};

if (Cars[thisCar].getIsCar() == true) {
Car trueCar = new Car("car");
cars.add(trueCar);
}

val car = Car()

That's because you're a brainlet

Car car1, car2, car3;
Car[] cars = new Car[] {car1 = new Car(1), car2 = new Car(2), car3 = new Car(3)};

Vehicle i = new Car();

>not using auto

That's also valid Kotlin.

IMPERATIVE REVOLUTION NOW

LINES ONLY
NO ENCAPSULATION
FINAL DESTINATION