Классы и объекты в C++

Я хочу создать класс, но в отдельном файле и подключать уже к main файлу. Возникает 2 вопроса:

1) Как правильно реализовать класс в отдельном файле?

2) И как можно объявлять объекты класса, вне main функции?

VBA: Errorhandling with GoTo and labels

Stackoverflow suggested I post my question here:

The code below works, but I want to ask if my solution is adequate or if there’s something I should structure differently. If it’s alright, I’ll apply the same code in other subs.

My code copies stuff from Excel to PowerPoint and inserts it as picture. In order to do this, I first have to copy data from one part of the sheet into a specific range. This range is where the summary and chart draw their input from. I then copy summary and chart for each VW into PowerPoint. The one issue that persists is that the line mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile frequently gives me an error: “Error -2147188160 Shapes (unknown member): invalid request. The specified data type is unavailable.” I had this issue in other files appear as well, but was solved by using DoEvents and Application.CutCopyMode = False.

Neither helped in this case, so my next best idea is to let VBA retry copy-pasting until it works (up to 20, so it doesn’t get stuck in an endless loop). I’m new to error handling and this is what I came up with (it’s a sub called from the main procedure); I marked the 4 labels/GoTo statements:

Public PowerPointApp As PowerPoint.Application Public myPresentation As PowerPoint.Presentation Public mySlide As PowerPoint.Slide      'in main sub:      'Set PowerPointApp = New PowerPoint.Application     'Set myPresentation = PowerPointApp.Presentations.Open("C:\....")       Sub SubSlide4(wsKAP As Worksheet, RangeArray As Variant)         'RangeArray = = Array("Range1", "Range2", "Range3"...)         Dim iSlide As Long         Dim rngVW As Variant         Dim fullNameVW As String         Dim ErrorCount4 As Long          iSlide = 4         ErrorCount4 = 0         For Each rngVW In RangeArray 'RangeArray has ~10 members               'Paste correct data for each VW              wsKAP.Range(rngVW).Copy             wsKAP.Range("tab.StartHeader").PasteSpecial Paste:=xlPasteValues             fullNameVW = "Test"             wsKAP.Range("C73") = fullNameVW              Set mySlide = myPresentation.Slides(iSlide)              'Copying Summary for each VW             Set rng = wsKAP.Range("C89:P97")             rng.Copy             DoEvents             mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile             Set myShape = mySlide.Shapes(mySlide.Shapes.Count)             With myShape                 .Left = 20                 .Top = 71                 .Height = 92             End With              'Copying Charts     RepeatOnError: '<-----------------------------------------------------             Set rng = wsKAP.Range("A30:Y69")             rng.Copy             DoEvents             On Error GoTo ErrorHandler '<-----------------------------------                 mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile                 Set myShape = mySlide.Shapes(mySlide.Shapes.Count)                 With myShape                     .Left = 20                     .Top = 187                     .Width = 686                 End With             iSlide = iSlide + 1             Application.CutCopyMode = False         Next rngVW      ErrorHandler: '<----------------------------------------------------------             If Err.Number = -2147188160 Then             If ErrorCount4 > 20 Then                 MsgBox "Too many errors (-2147188160), canceling"                 End             End If              ErrorCount4 = ErrorCount4 + 1             Debug.Print "ErrorCount4 is " & ErrorCount4             Resume RepeatOnError '<-----------------------------------------         End If         On Error GoTo 0     End Sub 

So whenever error -2147188160 occurrs, it should jump back to ‘RepeatOnError’ and try copy-pasting it once again. So far this has worked, but I wonder if this is the VBA way to go about error handling? Someone on stackoverflow suggested I need to use Exit Sub before the error handler – is that true?

Número primos em um intervalo [pendente]

Eu tenho um problema no trabalho da faculdade, ele se trata de um programa em que devo digitar 2 números e ver se tem e quais são os números primos, porém não posso usar estruturas de repetição. Aqui está o parcial do código. Desde já agradeço.

def jjj():     try:         a = int(input('Digite um número:  '))         return a     except:         print('Erro!!')         return jjj   # ------------------------------ def kkk(a):     try:         print(a)         b = int(input('Digite um número maior que o anterior:  '))         print(b)         if a >= b :             print('Erro!!')             return kkk(a)         else:             return b      except:         print('Erro!!')         return kkk(a)   # ----------------------------- def zzz(a, b):     x = 2     if a <= b:         if (a % 2) == 0 and a != x:             a += 1    # -----------------------------  a = jjj() b = kkk(a) 

Retrieve guest cart

When you create a guest cart you will receive a token that may look like this “696EreQdYt2AAtEceQsHfD2gxGyWFodG” and you can use it to retrieve a guest cart that has an id number.

I know how to retrieve the guest cart using the id. My question is, can I retrieve the guest cart using the token (programmatically)?

Can DDD entity rely upon infrastructure library?

Suppose I want this on my User entity:

user.createNewSecurityToken(); 

That means:

public void createNewSecurityToken() {   var buffer = new byte[32];   new RNGCryptoServiceProvider().GetBytes(buffer);  // <--- here's the issue   this.Token = Convert.ToBase64String(buffer); } 

This is not a DI dependency, just a class from the infrastructure. But does that “break” DDD?

The alternative is this:

user.setSecurityToken(token);   // pass it in (probably from a domain service) 

But that leads to anemic entities.

Which is the preferred DDD approach, and what considerations should I take into account when faced with this sort of design decision?

unknown apple id after reset

Hi good day i have a iPhone 5 and did delete my i cloud from it and rest it with find my iPhone turn of . On reboot it ask for unknown apple id which very strange what steps can i take to remedy this its iPhone 5 also on i cloud status check it shows my iPhone is of but activation status is on i didn’t even activate device. Also when google this i see it a very common problem. I have tried to reset again its the same problem

Can Sentinel at Death’s Door and Cutting Words combine to make a critical hit miss?

We already know from Sage Advice and other answers to other questions that by RAI, (and I guess RAW too), Cutting Words (and Bane) don’t work on critical hits, though in the case of Cutting Words they can still reduce the damage by an amount.

The Grave Domain’s 6th level feature, Sentinel at Death’s Door states that:

As a reaction when you or a creature you can see within 30 feet of you suffers a critical hit, you can turn that hit into a normal hit. Any effects triggered by a critical hit are canceled.

Does that mean that, since it is no longer a critical hit, that Cutting Words can now apply to it properly?

A follow up question: If the above is true then if a Bard cast Cutting Words before the Cleric used Sentinel at Death’s Door on a critical hit, does Cutting Words still apply?

Does all attachments in list get crawled in SP Online?

I have issues getting any result back from my sharepoint list. I have some jpg,ms word/excel and pdf files attached and sometimes i get results sometimes now. Any idea what is being actually crawled in the content sources for SP online? How do i know when was the last time the resource was crawled..i have re- indes so many times with no change If someone from MS team can give some clue here THanks in Advance

Where to stay in Paris for easy access to Palaiseau?

I will attend an event at Ecole Polytechnique in Palaiseau from Monday to Friday. The event will take place between 8am to 10pm, but some days it takes shorter (like until 5:30 pm). I may also have the weekends free before and after the event, so it is also a chance to see Paris.

Should I stay in Paris or in the suburbs (like Palaiseau, Massy, Saclay) close to Ecole Polytechnique? If the event ends at 5:30pm I will want to see the city, eat/drink, etc. I need to find a place that is safe and easily accessible by public transport to stay low on budget. Unfortunately budget is a concern for me, I only have 50-80 Euros for a night for accomodation.

Imprimir una cadena de texto hasta ser interrumpida

Tengo el siguiente objetivo:Escribe un programa que:

1 Le pida al usuario un string (una cadena de texto).

2 Si el string es “salir” (todo en minúsculas) el programa debe imprimir en la consola “Hasta pronto!” y terminar.

3 De lo contrario imprime en la consola lo que el usuario ingresó y repite el proceso desde el paso 1.

Como hago para que el programa no me imprima la palabra “salir” junto con las otras frases ingresadas y solo imprima frases ingresadas(-“salir”) + “hasta pronto!”

mi código:

do{   var str = prompt("Ingrese una frase: ");   console.log(str); }while(str != "salir"){   console.log("Hasta pronto!"); } 

Muchas gracias.