niusouti.com
更多“已知stu1和stu2是Student类的两个对象,则执行“stu1stu2”时会自动执行Student类的方法。() ”相关问题
  • 第1题:

    已知stu是Student类对象,则执行“print(stu)”时会自动执行Student类的()方法。

    A.__init__

    B.__str__

    C.__format__

    D.__print__


    __str__

  • 第2题:

    有student类,类中声明了公有静态数据成员id,建立student类的对象stu1,则关于数据成员id的访问,下列表达式正确的是:

    A.student::id

    B.stu1.id

    C.stu1::id

    D.student.id


    Student(int x){…}

  • 第3题:

    2、已知Student类有一个属性__id,stu是Student类的对象,则通过“stu.__id='1810101'”可以将stu对象中的__id属性赋值为字符串'1810101'。


    错误

  • 第4题:

    已知Student类有一个属性__id,stu是Student类的对象,则通过“stu.__id='1810101'”可以将stu对象中的__id属性赋值为字符串'1810101'。


    错误

  • 第5题:

    1、已知stu是Student类对象,则执行“print(stu)”时会自动执行Student类的()方法。

    A.__init__

    B.__str__

    C.__format__

    D.__print__


    B