Car car = new Car();

Car car = new Car();

Attached: img.jpg (1242x1290, 64K)

Looks like C++.
I can tell C++ from C because only retards use C++. That is retarded code (on purpose, I know OP was making fun of it.)
So, why don't we just have a CPP holocaust?

it's not.

The "new" keyword is banned in pretty much every modern C++ codebase. You are just retarded.

auto mein_auto = Auto{};

Attached: thumans.gif (262x350, 29K)

STOP MAKING FUN OF C++

Attached: 1517669666962.png (256x219, 25K)

new CarFactory()

Bullshit, new is needed whenever you don't want to trigger destructors and when you can't use the initializer list to initialize an object member

>Looks like C++.
Car car;
You're welcome retard.

>new is needed whenever you don't want to trigger destructors
>Being this retarded

Use smart pointers and never post on this board ever again.

I will post whenever I want, I'll do it right now actually

>new is needed whenever you don't want to trigger destructors
what did he mean by this

Attached: 1512047745019.jpg (645x729, 64K)

Attached: 268zj7.jpg (645x729, 26K)

Jav

He's only written simple functions before and is thinking everything goes out of scope if it isn't "global"

is this what a currynigger thinks 'new' means in C++?

that's only for move operations on templates when you need to instantiate multiple dynamic bindings to noexcept data members

car = car;

Attached: 1518560962631.png (264x273, 88K)

car *c = new_car();

Car car;
car.create(leather);
car->drive()

car = new

var car = new Car();

This is valid C++.
Wrong, the use of new is going to be there forever. Even if you use a wrapper around it, it doesn't "ban" the usage of new.

Car car = (Car) new Object();

Attached: 5732.jpg (228x221, 5K)

>this is valid c++
it's not. try it if you want.

car := newCar()

That's the wrong way to do oop


Car car = new Vehicle();

Gotta get polymorphism in there dumbass, thats the whole point

>This is valid C++.
Not without a thing called pointer.

String string = new String("string");

Foo foo = build_foo();
Car* car = (Car*)&foo

Attached: zachqwe1o4w01.jpg (645x773, 53K)

Vehicle Car = new Car(); is the non-pleb version.

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

Or maybe it's
Vehicle car = new Car();


I dont actually remember. Haven't touched that shit in a long time

Pajeet pajeet = new OP();

Attached: disgusting.jpg (600x600, 84K)

Now you can't acess the methods from Car without casting it.

I know what the fuck new does. I used the heap more than you ever have.
There are cases in which you don't want an object to be destroyed.
The destructor for example could free other dynamically allocated memory that you want to preserve.

It's that simple. Is it so hard to understand?

Attached: nigger.jpg (566x480, 65K)

(define (car car)
(if (number? car)
"not a number"
(if (image? car)
"car" "not car")))

This. No point in doing it.

Dude.... car is a built-in keyword in Scheme...

the whole point of polymorphism is that we don't care about the concrete type

ur dumb son

But my mom says I'm an special boy

public class Vehicle {
String make;
String model;

public Vehicle(String make, String model){
this.make = make;
this.model = model;
}
}

public class Car extends Vehicle {

public Car(String make, String model){
super(make, model);
}
}

public static void main() {
Vehicle C = new Car("Ford", "Focus");
}

Hello, I am java EXPERT, I will work for much less than white man. Long long hours! Please sponsor visa

Attached: theenemy.png (1920x1080, 1.97M)

fpwp

>steals your remote work for 1/100th of the salary

proclaim myCar = Car()
[expanding_brain_universe.png]

4

Not that user but there is a reason, if you are overloading a function in a derived class.
E.g.
#include
class Foo {
public:
void func(void);
};

void Foo::func(void) {
printf("Foo::func\n");
}

class Bar : public Foo {
public:
using Foo::func;
void func(void);
};

void Bar::func(void) {
printf("Bar::func\n");
}

int main(int argc, char** argv) {
Foo* foo = new Bar();
foo->func();
Bar* bar = (Bar*)foo;
bar->func();
}
Outputs:
Foo::func
Bar::func

you mean j*va or c#, r-r-right?

Java is retarded

Old New = new Old();

Attached: 1531610362332.jpg (720x1280, 157K)

behold the power of java

>I used the heap more than you ever have.
>There are cases in which you don't want an object to be destroyed.
This is way too retarded to not be bait.
You've never heard about memory leaks did you?

Any decent OS will clean up the memory allocated when the process ends.

You can't be serious...
People like you should just be banned from using computers.

I didn't say to completely ignore memory management, just that if you have something with a lifespan of 'entire program' you can create it and forget.

>I'm an H1B pajeet that writes unmantianable code that can't be reused in any context

What shit OS are you using, user?
I graduated from Purdue

Did you take an OS course there? Im not that user btw.

I got an A+

>I graduated from Purdue
i see your problem

Any self respecting university doesn't give an 'A+'.

4.0 = A, no plus

he's not wrong though. any resource leaks should be reclaimed on exit or your shit sucks anyhow.

Purdue does + and - but + doesn't give anything better. E.g. A+ == A. A- != A

Oh dear, you're not very good at C++, are you?

This is one of the reasons Purdue has had such low grade inflation. Getting a 4.0 means you need to get 93%+ in every class after the curve, not just a 90%.

What OS did they give you for your projects? My school flip flops between PintOS and OS161, presumable to cut down on cheating

Xinu since Comer, the TCP/IP god, wrote it and requires it IIRC.

Yeah my school has like a baby OS class where you implement shit in Xinu then two years later you take the grad-level OS course with PintOS or some shit, real aids

Ended up taking it as a CompE major (only required for CS kids) to fulfill a senior level CS elective requirement

The kids in my course are dumb as fucking rocks, it's depressing how bad CS departments are at some schools

>it's depressing how bad CS departments are at some schools
Sounds pretty much the same as my experience, coming as CS most of the people that knew their shit were CE majors.

Yep, and this is a summer course so there's no TAs nor office hours but the projects are just a brutal as always, and there's a few groups who turn shit in within a week of it being released with a 100%. Basically guaranteed cheating, and I'd be willing to bet my tuition that the Ph.D candidate teaching the course does absolutely nothing about it. Wouldn't want to make his tenure track pipe dream look bad by failing half the class! CS is a joke.

i couldn't imagine why a shared_ptr wouldn't meet all your stringent requirements though.

not like you're using weak_ptrs.... are you?

That's such a retarded use of polymorphism. Vehicle car = new Car();

At least Purdue is putting effort into solving the problem. They are apparently splitting CS into actual CS and Game Dev to weed out the retards even further.
Sorry to hear about your summer class, though. Sounds tough user but I'm sure you can make it through

Car car;

auto *car = new Car;

Pick one.

>bbbbut the os cleans it up!
Ok, now what if you want to make your program into a reusable third party library?

Then it gets cleaned up when the process using it ends.

let car = new Car();

That isn't valid C++. I think you meant to do Vehicle *car = new Car();
Even then, I disagree with that being the non-pleb version. Only plebs used inheritance-based OOP models. A good program defines an entity class and various components needed to give that entity the functionality of a car

No, you are just a retard. There is a damn good reason why tools like Valgrind clearly distinguish between "still reachable" leaks (ie. memory that doesn't get explicitly deallocated because the process ends and cleans it up. and other kinds of leaks. Every programmer worth their salt knows that "still reachable" doesn't mean shit.

To be fair large leaks that are "still reachable" are a problem but the rest of what you said is correct.

underrated

>missing the point of OOP
>not knowing about polymorphism
>being this retarded...

Wtf is this and why have I seen this before

wey nut use spring moter......
first class and factroy
public class Vehicle {

// ban chod must private
private String make;
private String model;

public Vehicle(String make, String model){
this.make = make;
this.model = model;
}

public String getMake() {
return make;
}

public void setMake(String make) {
this.make = make;
}

public String getModel() {
return model;
}

public void setModel(String model) {
this.model = model;
}
}

import org.springframework.beans.factory.FactoryBean;

public class VehicleFactory implements FactoryBean {

private int factoryId;
private String vehicleMake;
private String vehicleModel;

@Override
public Vehicle getObject() throws Exception {
return new Vehicle(vehicleMake, vehicleModel);
}

@Override
public Class getObjectType() {
return Vehicle.class;
}

@Override
public boolean isSingleton() {
return false;
}

public int getFactoryId() {
return factoryId;
}

public void setFactoryId(int factoryId) {
this.factoryId = factoryId;
}

public String getVehicleMake() {
return vehicleMake;
}

public void setVehicleMake(String vehicleMake) {
this.vehicleMake = vehicleMake;
}

public String getVehicleModel() {
return vehicleModel;
}

public void setVehicleModel(String vehicleModel) {
this.vehicleModel = vehicleModel;
}
}

then de factory bean......

import VehicleFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CarFactoryBean {
@Bean(name = "ferrari")
public VehicleFactory vehicleFactory() {
VehicleFactory factory = new VehicleFactory();
factory.setFactoryId(23);
factory.setVehicleMake("Ferrari");
factory.setVehicleModel("Enzo");
return factory;
}

@Bean(name = "ford")
public VehicleFactory fordFactory() {
VehicleFactory factory = new VehicleFactory();
factory.setFactoryId(12);
factory.setVehicleMake("Ford");
factory.setVehicleModel("Focus");
return factory;
}
}


import CarFactoryBean;
import Vehicle;
import VehicleFactory;
import javax.annotation.Resource;

import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = CarFactoryBean.class)
@SpringBootTest
public class GetchApplicationTests {
@Autowired
private Vehicle ferrari;

@Autowired
private Vehicle ford;

@Resource(name = "&ferrari")
private VehicleFactory ferrariFactory;

@Resource(name = "&ford")
private VehicleFactory fordFactory;

@Test
public void testFerrari() {
assertThat(ferrari.getMake(), equalTo("Ferrari"));
assertThat(ferrari.getModel(), equalTo("Enzo"));
assertThat(ferrariFactory.getFactoryId(), equalTo(23));
}

@Test
public void testFord() {
assertThat(ford.getMake(), equalTo("Ford"));
assertThat(ford.getModel(), equalTo("Focus"));
assertThat(fordFactory.getFactoryId(), equalTo(12));
}

}

kek

underrated

car{} = Car

Never used Spring but understand the design pattern. Why does the factory need an ID? It seems pointless. Am I missing something?

don't take the post seriously

>C++
That's java morans.

>being this new

(make-car)

Im going to see if i can sneak this into a pr

imagine not using c# in 2018