C++ Object Instantiation

后端 未结 9 2016
孤街浪徒
孤街浪徒 2020-11-30 16:36

I\'m a C programmer trying to understand C++. Many tutorials demonstrate object instantiation using a snippet such as:

Dog* sparky = new Dog();
9条回答
  •  盖世英雄少女心
    2020-11-30 16:48

    I had the same problem in Visual Studio. You have to use:

    yourClass->classMethod();

    rather than:

    yourClass.classMethod();

提交回复
热议问题