Похожие чаты

How to do this ques?

10 ответов

18 просмотров

I think it explains pretty clearly step by step how. At what part of it you got stuck?

none- Автор вопроса

Is this correct sol?

none
screenshot Is this correct sol?

You need to give some implementation to play in Game class or do virtual void play() = 0; which makes it "pure virtual", otherwise compiler going to complain about that. Also you need to ideally add public: to the derived classes also. Otherwise it looks correct. If you want to make it a bit more advanced, you can dynamically allocate the games in main function and delete them at the end or use std::unique_ptr<Game>

none- Автор вопроса
Pavel
You need to give some implementation to play in Ga...

Okk sir, compiler didn't complain in my case tho And one more ques why should ideally public be added to derived class? Compiler is not complaining abt it

none
Okk sir, compiler didn't complain in my case tho A...

I think if you don't make it public and try to call play on the derived class (which you don't do in your program but may want to do in reality in some cases) then that won't compile. But I may be wrong

none- Автор вопроса
Pavel
I think if you don't make it public and try to cal...

Yes, when I create a pointer to derived class and try to access play() its showing declared private. Thankyou sir!!

I usually use struct to denote that it's not an OOP S.O.L.I.D. class but just a bunch of data tied together

Nomid Íkorni-Sciurus Lomysz
but it is de facto

well, it can be or not, depending on how you use it

none
screenshot Is this correct sol?

add = 0 after void play() in Games class

Похожие вопросы

Обсуждают сегодня

а через ESC-код ?
Alexey Kulakov
29
30500 за редактор? )
Владимир
47
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
Привет)) уже кажется эту тему перемусолили, но вот я так и не понял. Я сейчас сижу на 27дюймов 2к мониторе. На Актуальной макоси, если я куплю 27д 4к монитор: - будет ли изобр...
Vladislav Piskunov
15
Hi guys, any problem with Pulsebrige? Trying to transfer from wETH to ETH. First it tells me to connect my metamask "through mobile app" not desktop. Then I did and confirmed ...
Snowflakecrypto
13
any reference of this implementation?
BitBuddha
29
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
~
13
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
&"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\bin\Hostx64\x64\dumpbin.exe" /EXPORTS C:\Users\Yeet\Tauon\vcpkg\installed\x64-window...
Martin Rys
6
Карта сайта