Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

tendaipaswavairi

  • 2 years ago

what is class declaration and defination in object oriented programming

  • This Question is Open
  1. Chris2332
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I think you could start by reading more generally about object oriented programming. You can use the following link: http://en.wikipedia.org/wiki/Object-oriented_programming

  2. Chris2332
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    This might be helpful as well: http://docs.oracle.com/javase/tutorial/java/concepts/

  3. Chris2332
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Finally, if you fancy reading: http://www.codeproject.com/Articles/22769/Introduction-to-Object-Oriented-Programming-Concep Apologies for the multiple posts... just looking around and posting!

  4. bthemesandtricks
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You can also check out this pdf. its all about oop (object oriented language) http://www.mathworks.com/help/pdf_doc/matlab/matlab_oop.pdf

  5. itsArun
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    In general, declaration instructs compiler that such a class(in general type) exists. Definition allocates memory when an object is created using the class. ex: int i; // this is both declaration and definition Person P; // Assume Person as class, then this is also declaration and definition. extern int i; // just a declaration. The variable is defined elsewhere extern Person P; // just a declaration. The variable is defined elsewhere Hope this helps.

  6. ArtiMehta
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @itsArun - why is int i both declaration and definition whereas extern int i just a declaration?

  7. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    what language are you talkig about python or java

  8. bthemesandtricks
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Java

  9. Chris2332
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    extern is a C/C++ keyword. @istArun I think you have confused the declaration, the definition and the instantiation of classes and what you wrote is not particularly helpful, rather than confusing!

  10. Chris2332
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    On a side note, don't confuse primitive types with classes!

  11. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    so simple a class is a couples of objects , so class al last have one object to start over and called as a class . the definition in programming is simple start write public class simpleclass { simpleclass(){}}

  12. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    huh class don't have premitive type it has others definition or others type like protection type , like an abstract class or an interface class , but premetives is just for variables

  13. bthemesandtricks
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    hmm

  14. Chris2332
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    In java: Definition of class: public class Bicycle { // the Bicycle class has // three fields public int cadence; public int gear; public int speed; // the Bicycle class has // one constructor public Bicycle(int startCadence, int startSpeed, int startGear) { gear = startGear; cadence = startCadence; speed = startSpeed; } // the Bicycle class has // four methods public void setCadence(int newValue) { cadence = newValue; } public void setGear(int newValue) { gear = newValue; } public void applyBrake(int decrement) { speed -= decrement; } public void speedUp(int increment) { speed += increment; } } Declaration of the above class: Bicycle myBicycle; Instantiation of the above class: Bicycle myBicycle = new Bicycle(1, 0, 1); // You pass the required parameters to the constructor. It can be done in two steps but it's a matter of style: Bicycle myBicycle; myBicycle = new Bicycle(1, 0, 1); Hope that makes things clear!

  15. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Chris2332 why you used to write that Bicycle myBicycle; myBicycle = new Bicycle(1, 0, 1); you can just write Bicycle myBicycle = new Bicycle(1, 0, 1); and her you will win a line

  16. Chris2332
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Just said that it can be done in two steps if you want and it is just a matter of style! One line is perfectly fine!

  17. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    hh Chris you right i think you have also an advancer java and that's good i have done that's ps just in case you will passed some certificat as OCJP bcz that line will matter hh

  18. bthemesandtricks
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    So how can I program a bible in Java Programming Language

  19. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    bthemesandtricks can you be more clear ?!!!

  20. bthemesandtricks
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Like a bible software

  21. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    i didn't get it yet ? explain plz tell more detaills

  22. ArtiMehta
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I am making an attempt to answer this question though being a beginner myself. REQUEST ALL EXPERTS here to correct immediately if it is wrong. My explanation may not use technical jargons as I am very new to programming. Class can be compared to a template whereby you define basic features/attributes for any Object you wish to create from it in the future. Thus Class definition is defining what all basic features/functionality you wish to have in your future object derived from it. Something like a blueprint from which you will create real thing going forward. For e.g. Class Automobile can have attributes like Colour, Door, Engine, etc and Functions like "StartTheCar"", "ReverseTheCar", "StopTheCar" etc which defines what all the automobile can do. Class Declaration is using the template you just defined. i.e. declaring an object of class Automobile. So this could be any car such as Merc, BMW, or XYZ ...

  23. bthemesandtricks
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Hey billel I want a java code to be able to write a bible software

  24. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    you totaly right in basic understanding yes that's the general describing not as philosophycs but you right congradulation :)

  25. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ok i will help you but what you mean by a bibl softwar ; do you mean by that a simple oftwar guid you to others softwar like a small refferance for web sites ?

  26. Chris2332
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @bthemesandtricks I think you are not in the correct forum to be asking for java code. You could try http://www.coderanch.com/ and similar websites!

  27. bthemesandtricks
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks Man

  28. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    gd lctal

  29. bthemesandtricks
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    kk

  30. billel
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @bthemesandtricks if ( you need help == true ) System .out .println(" we will help you anyway");

  31. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.