orangepic333 said:
Could someone tell me what's the difference between the two?
Is it that a class is used within an OO language while a component can
be exported between OO languages?
Are there other differences?
You are sort of right.
"class" is a keyword in both C++ and Java. In both languages, a class
consists of data members grouped together, and functions or methods that act
on them. Usually the data members are made "private", so only the class
methods have direct access to them.
Where C++ and Java differ is the way in which classes can enter into
relationships with each other. Both allow inheritance, though Java calls it
extension. C++ allows multiple inheritance, whilst Java allows classes to
implement interfaces.
Now "component" doesn't have a defined meaning in either language. So you
need to know what context the person is using the term in. He may mean
simply a library, or a visual window on a GUI. In Java, he probaly means a
Java "bean", which is a special sort of Java class that can serialise
itself, and can be instantiated without source code. In a Microsoft context,
he probably means COM, the Microsoft component interface. This is basically
a C++ interface but is formally language-independent. Essentially
applications use a third party library by querying for supported
"interfaces". Direct X is built round COM, so that different graphics
hardware devices can be accessed by the same game without the need to
compile for all platforms.