Hi,
I have background in Java and I am slowly trying to learn Qt.
I would like to understand the Qt's equivalent of Java's packages.
I know that namespaces are the closest to Java's packages, but I would like to
see a concrete example, for instance, how would I express the code below in Qt:
//File my/first/package/MyFirstClass.java
package my.first.package;
class MyFirstClass {}
//File my/first/package/MyFirstClass.java
package my.first.package;
class MyFirstClass {}
To copy to clipboard, switch view to plain text mode
//File my/second/package/MySecondClass.java
package my.second.package;
class MySecondClass {}
//File my/second/package/MySecondClass.java
package my.second.package;
class MySecondClass {}
To copy to clipboard, switch view to plain text mode
//File my/main/package/MyMainClass.java
package my.main.package;
import my.first.package.MyFirstClass;
import my.second.package.MySecondClass;
class MyMainClass {
//Use MyFirstClass and MySecondClass here
MyFirstClass myFirst = new MyFirstClass();
MySecondClass mySecond = new MySecondClass;
}
//File my/main/package/MyMainClass.java
package my.main.package;
import my.first.package.MyFirstClass;
import my.second.package.MySecondClass;
class MyMainClass {
//Use MyFirstClass and MySecondClass here
MyFirstClass myFirst = new MyFirstClass();
MySecondClass mySecond = new MySecondClass;
}
To copy to clipboard, switch view to plain text mode
I would like to see how the corresponding Qt headers and classes are stored in the
directories on the disk, from which they are included.
If someone could provide my with an example of this, I would be very thankfull.
Thank you in advance!
Kind Regards,
Veroslav
Bookmarks