×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT技术讨论 / Could you help me ?I am trying to learn some classes about database access in VC++.
    But I am confused by some examples:when I define a variable of a class like CDaoDatabase or CDaoRecordset ,could I use it to call it's member function without creating an instance of the class?
    such as: CDaoDatabse db;
    db.open(...);
    CDaoRecordset rs;
    rs.open(...);
    (why not CDaoRecordset* prs;prs=new CDaoRecordset())
    • 1. You can use CDaoRecordset* prs;prs=new CDaoRecordset(); But memory allocation is diferent from your example. 2. If a method in a class is static, you can use it without creating an object of the class.
      • "CDaoRecordset rs; " It has create a object of CDaoRecordset. rs refers to the object. Right?