Похожие чаты

How to do this ques?

10 ответов

8 просмотров

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

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

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

Happy Friday and happy CartesiWeekly! This week on the list: 🪲 Bug Buster Update 🎥 Erick de Moura’s interview with Ornella from Web3TV 👽 Thriving Cartesi alien 🇧🇷 SBRC hackat...
Nida | Cartesi - Never DM first or ask for funds!
1
Hi everyone! I have a two-folded message to share today. First: updates and news, as we are being asked for those. We still want to go like we did the last 6 years: we w...
Marten | Unibright.io
31
Скажите, можно ли как-то "переместить" динамический массив из одной переменной в другую? Скажем, переместить из TList<> в TArray<>. Именно переместить, а не скопировать. Если ...
Eugene Krasnikov (ᴊɪɴ x)
37
Oh.... Admins at the main TG is already muted me. How many months Sir you muted me? Or forever if you are here @Janevietani @JohnnySonic
Charles Dar
28
комрады, че-та лыжы не едут var tmpFont: TFont; begin tmpFont:= TFont.Create; try case rgFontColor.ItemIndex of 0: tmpFont.Color:= clWindowText; 1: tmpFo...
Ed Doc
34
Вот еще криповенькая штука. uMain.pas(517,3) Warning: Case statement does not handle all possible cases И ЧО? 😂
Александр (Rouse_) Багель
15
.model small .stack 100h .data a db 'Hello, World!', '$' ; исходная строка b db 20 dup(?) ; строка b с запасом на максимальную длину .code main: ...
Алексей -man
3
вопрос, кого посмотреть в ютубе или где почитать про указатели чтобы раз и навсегда запомнить зачем они нужны и как правильно ими пользоваться? поделитесь хорошими ресурсами, ...
-
14
М-да. Почему бы просто со stringlist не работать?
Michael Longneck
23
Интересно, нет ли какого-то способа получить из dll не адрес самой метки, а адрес со смещением?
The Bird of Hermes
54
Карта сайта