I'm just getting started in programming with MySQL 8/Connector C++. Everything is built and linked and working but I have a question about how to make use of this in a true C++ Object Oriented program.
All of the classes require full configuration on instantiation. That means, for example, that I could NOT do this in my own class definition:
class myClass {
public:
mysqlx::Session mySession;
mysqlx::Table myTable;
etc...
};
where I would instantiate an object of myClass and the configure myClass.mySession, myClass.myTable, and so on.
That seems to say that not only can I not make use of object oriented programming but I also can't make use of functions, because every function that I want to use to access the database I will have to locally instantiate Session and Table objects, so I end up duplicating a lot of code.
What am I missing?
All of the classes require full configuration on instantiation. That means, for example, that I could NOT do this in my own class definition:
class myClass {
public:
mysqlx::Session mySession;
mysqlx::Table myTable;
etc...
};
where I would instantiate an object of myClass and the configure myClass.mySession, myClass.myTable, and so on.
That seems to say that not only can I not make use of object oriented programming but I also can't make use of functions, because every function that I want to use to access the database I will have to locally instantiate Session and Table objects, so I end up duplicating a lot of code.
What am I missing?