+ 6

Why are C++ and Java called Object oriented programmng languages?

Please explain in easy language with syntax or codes as examples. Thank you

20th Aug 2017, 10:41 AM
Abhishek Tandon
Abhishek Tandon - avatar
3 Réponses
+ 4
So that simply means that all objects inside a function are being called whenever they are to be used ?
20th Aug 2017, 12:40 PM
Abhishek Tandon
Abhishek Tandon - avatar
+ 2
Its possible to force the concept of object oriented programming into almost any language but there is a difference between a programming language that allows for OOP (Object oriented programming) and one that expands upon the concept. In a short summary, think of any store as a program. The company name would be the program name, and you could have class files for (objects) for things like merchandise, the register, backroom, etc. For instance buying something would call the registers method register.transaction() and would look something like this onsode the program: public double transaction(int cashTendered, Merchandise m){ double price = m.getprice(); //this gets the price of the m object
20th Aug 2017, 12:16 PM
Will
+ 1
more or less, you need to use a constructor to call instances of an object. somwthing like ClassName(){ <optional variable declarations and statements> } and would call the constructor by doing ClassName variableName = new ClassName(); other wise for static classes (ones you can't create an instance of) you can just reference ita variables by doing ClassName.variableName
20th Aug 2017, 12:55 PM
Will